static void ebs_overflow_handler(struct perf_event *event, struct perf_sample_data *data, struct pt_regs *regs) #endif { int cpu = smp_processor_id(); if (event != per_cpu(pevent_ebs, cpu)) return; // Output backtrace gator_add_sample(cpu, BACKTRACE_BUF, regs); // Collect counters collect_counters(); }
/* * Parent: wait for kids to get ready, start them, wait for them to * finish, read and accumulate results. */ void parent( int children, int load, char * mix_file, char * iodist_file) { char string[80]; /* for interactive startup */ int result; int invalid_run; /* holds INVALID RUN status */ int runtime_val; /* store Runtime value to be printed later */ int Saveerrno; char *nameptr; #if (defined(_XOPEN_SOURCE) || defined(USE_POSIX_SIGNALS)) struct sigaction sig_act, old_sig_act; #endif /* * Setup a SIGCHLD handler in case one of our beloved children dies * before its time. */ #if (defined(_XOPEN_SOURCE) || defined(USE_POSIX_SIGNALS)) /* use XOPEN signal handling */ sig_act.sa_handler = sfs_reaper; (void)sigemptyset(&sig_act.sa_mask); sig_act.sa_flags = 0; if (sigaction(SIGCHLD,&sig_act,&old_sig_act) == -1) { perror("sigaction failed: SIGCHLD"); exit(66); } #else (void) signal(SIGCHLD, sfs_reaper); #endif /* Change my name for error logging */ if ((nameptr = strrchr(sfs_Myname, '/')) != NULL) sfs_Myname = ++nameptr; /* * store the Runtime value; to be printed in results */ if (Prime_client) runtime_val = Runtime - MULTICLIENT_OFFSET; else runtime_val = Runtime; /* print logfile header information */ (void) fprintf(stdout,"\n"); (void) fprintf(stdout, "************************************************************************"); (void) fprintf(stdout,"\n"); (void) fflush(stdout); /* print sfs information */ if (Prime_client) { (void) fprintf(stderr, "\nSFS NFS Version %d Benchmark Client Logfile, %s\n", nfs_version, lad_timestamp()); (void) fprintf(stderr, "\tClient hostname = %s\n", lad_hostname); (void) fprintf(stderr, "\tPrime Client hostname = %s\n", Prime_client); } (void) fprintf(stderr, "\nSPEC SFS Benchmark Version %s, Creation - %s\n", SFS_VERSION_NUM, SFS_VERSION_DATE); (void) fprintf(stderr, "NFS Protocol Version %d\n", nfs_version); /* mount test directories */ (void) fprintf(stderr, "%s Mounting %d remote test directories.\n", lad_timestamp(), children); synchronize_children(children); (void) fprintf(stderr, "%s Completed.", lad_timestamp()); /* * if multi-client execution then tell Prime-Client I'm done mounting * test directories. */ if (Prime_client) { (void) fprintf(stderr, "\n"); (void) fprintf(stderr, "%s Sending DONE-MOUNT message to Prime Client(%s).\n", lad_timestamp(), Prime_client); if ((result = (int) signal_Prime_Client("CLIENT_SIGNAL", "")) == (int) RPC_SUCCESS) { (void) fprintf(stderr, "%s Completed.",lad_timestamp()); (void) fflush(stderr); } else { (void) fprintf(stderr, "\n"); (void) fprintf(stderr, "%s: error %d sending DONE-MOUNT message to Prime Client\n", sfs_Myname, result); /* cleanup and exit */ #if (defined(_XOPEN_SOURCE) || defined(USE_POSIX_SIGNALS)) sig_act.sa_handler = SIG_DFL; (void)sigemptyset(&sig_act.sa_mask); sig_act.sa_flags = 0; if (sigaction(SIGCHLD,&sig_act,&old_sig_act) == -1) { perror("sigaction failed: SIGCHLD"); exit(67); } #else (void) signal(SIGCHLD, SIG_DFL); #endif (void) generic_kill(0, SIGINT); exit(68); } (void) fprintf(stderr, "\n"); (void) fprintf(stderr, "%s Waiting on DO-INIT message from Prime Client(%s).\n", lad_timestamp(), Prime_client); (void) fflush(stderr); /* * wait for DO-INIT message from Prime Client * sfs_syncd (rpc server) sends a SIGUSR1 signal; * user can also terminate experiment anytime they wish * with SIGINT or SIGTERM signal */ (void) pause(); (void) fprintf(stderr, "%s Received.",lad_timestamp()); (void) fflush(stderr); } /* send DONE-MOUNT and got DO-INIT message */ /* initialize test directories */ (void) fprintf(stderr, "\n"); (void) fprintf(stderr, "%s Initializing test directories.\n", lad_timestamp()); /* send SIGUSR1 to child processes */ (void) generic_kill(0, SIGUSR1); synchronize_children(children); (void) fprintf(stderr, "%s Completed.", lad_timestamp()); (void) fflush(stderr); /* * if multi-client execution then tell Prime-Client I'm done initializing * and wait for synchronized do warmupmessage. */ if (Prime_client) { (void) fprintf(stderr, "\n"); (void) fprintf(stderr, "%s Sending DONE-INIT message to Prime Client(%s).\n", lad_timestamp(), Prime_client); if ((result = (int) signal_Prime_Client("CLIENT_SIGNAL","")) == (int) RPC_SUCCESS) { (void) fprintf(stderr, "%s Completed.",lad_timestamp()); (void) fflush(stderr); } else { (void) fprintf(stderr, "\n"); (void) fprintf(stderr, "%s: error %d sending DONE-INIT message to Prime Client\n", sfs_Myname, result); /* cleanup and exit */ #if (defined(_XOPEN_SOURCE) || defined(USE_POSIX_SIGNALS)) sig_act.sa_handler = SIG_DFL; (void)sigemptyset(&sig_act.sa_mask); sig_act.sa_flags = 0; if (sigaction(SIGCHLD,&sig_act,&old_sig_act) == -1) { perror("sigaction failed: SIGCHLD"); exit(69); } #else (void) signal(SIGCHLD, SIG_DFL); #endif (void) generic_kill(0, SIGINT); exit(70); } (void) fprintf(stderr, "\n"); (void) fprintf(stderr, "%s Waiting on DO-WARMUP message from Prime Client(%s).\n", lad_timestamp(), Prime_client); (void) fflush(stderr); /* * wait for DO-WARMUP message from Prime Client * sfs_syncd (rpc server) sends a SIGUSR1 signal; * user can also terminate experiment anytime they wish * with SIGINT or SIGTERM signal */ (void) pause(); (void) fprintf(stderr, "%s Received.",lad_timestamp()); (void) fflush(stderr); } /* send DONE-INIT and got DO-WARMUP message */ if (Populate_only) { (void) fprintf(stderr, "\nPopulating directories and exiting.\n"); #if (defined(_XOPEN_SOURCE) || defined(USE_POSIX_SIGNALS)) sig_act.sa_handler = SIG_DFL; (void)sigemptyset(&sig_act.sa_mask); sig_act.sa_flags = 0; if (sigaction(SIGCHLD,&sig_act,&old_sig_act) == -1) { perror("sigaction failed: SIGCHLD"); exit(71); } #else (void) signal(SIGCHLD, SIG_DFL); #endif (void) generic_kill(0, SIGUSR1); while (wait((int *) 0) != -1) { /* nop */ } return; } /* do warm-up */ if (Warmuptime) { (void) fprintf(stderr, "\n"); (void) fprintf(stderr, "%s Performing %d seconds pretest warmup.\n", lad_timestamp(), Warmuptime); (void) generic_kill(0, SIGUSR1); (void) sleep(Warmuptime); (void) fprintf(stderr, "%s Completed.", lad_timestamp()); (void) fflush(stderr); } if (Interactive) { (void) fprintf(stderr, "\n"); (void) fprintf(stderr, "Hit <return> when ready to start test ..."); (void) fgets(string,10,stdin); } /* * if multi-client execution then tell Prime-Client I'm done warm-up * and wait for synchronized Start message. */ if (Prime_client) { (void) fprintf(stderr, "\n"); (void) fprintf(stderr, "%s Sending READY message to Prime Client(%s).\n", lad_timestamp(), Prime_client); if ((result = (int) signal_Prime_Client("CLIENT_SIGNAL","")) == (int) RPC_SUCCESS) { (void) fprintf(stderr, "%s Completed.",lad_timestamp()); (void) fflush(stderr); } else { (void) fprintf(stderr, "\n"); (void) fprintf(stderr, "%s: error %d sending READY message to Prime Client\n", sfs_Myname, result); /* cleanup and exit */ #if (defined(_XOPEN_SOURCE) || defined(USE_POSIX_SIGNALS)) sig_act.sa_handler = SIG_DFL; (void)sigemptyset(&sig_act.sa_mask); sig_act.sa_flags = 0; if (sigaction(SIGCHLD,&sig_act,&old_sig_act) == -1) { perror("sigaction failed: SIGCHLD"); exit(72); } #else (void) signal(SIGCHLD, SIG_DFL); #endif (void) generic_kill(0, SIGINT); exit(73); } (void) fprintf(stderr, "\n"); (void) fprintf(stderr, "%s Waiting on START message from Prime Client(%s).\n", lad_timestamp(), Prime_client); (void) fflush(stderr); /* * wait for START message from Prime Client * sfs_syncd (rpc server) sends a SIGUSR1 signal; * user can also terminate experiment anytime they wish * with SIGINT or SIGTERM signal */ (void) pause(); (void) fprintf(stderr, "%s Received.",lad_timestamp()); (void) fflush(stderr); } /* send READY and got START message */ (void) fprintf(stderr, "\n"); if (Timed_run) { if (Prime_client) { (void) fprintf(stderr, "%s Starting %d seconds test run.\n", lad_timestamp(), Runtime - MULTICLIENT_OFFSET); } else { (void) fprintf(stderr, "%s Starting %d seconds test run.\n", lad_timestamp(), Runtime); } } else { (void) fprintf(stderr, "%s Starting %d call test run.\n", lad_timestamp(), Ops[TOTAL].target_calls); } (void) fflush(stderr); /* signal child processes to go */ (void) generic_kill(0, SIGUSR1); if (Timed_run) (void) sleep(Runtime); #if (defined(_XOPEN_SOURCE) || defined(USE_POSIX_SIGNALS)) sig_act.sa_handler = SIG_DFL; (void)sigemptyset(&sig_act.sa_mask); sig_act.sa_flags = 0; if (sigaction(SIGCHLD,&sig_act,&old_sig_act) == -1) { perror("sigaction failed: SIGCHLD"); exit(74); } #else (void) signal(SIGCHLD, SIG_DFL); #endif if (Timed_run) { /* * The parent and the prime are both sleeping for Runtime. * If the parent wakes up first, he'll tell the children to stop. * If the prime wakes up first, he'll send an SIGALRM (via syncd) * to the parent. That alarm may arrive while the parent is still * asleep, which is ok, or after he has starting running. Since * the parent SIGARLM catcher does nothing, there is no harm done * by the extra signal in this case. * * Perhaps, if running multi we should just wait (pause()) for * the STOP signal, like we waited for the start signal. It would * be more obvious. The only drawback is the OTW rpc delay in * receiving the stop signal from the prime. */ (void) generic_kill(0, SIGUSR2); /* tell children to finish */ } /* Wait for all the children to finish/die */ while (wait((int *) 0) != -1) { /* nop */ } (void) fprintf(stderr, "%s Completed.", lad_timestamp()); (void) fflush(stdout); (void) fflush(stderr); /* Initialize and sum up counters */ collect_counters(children); if ((invalid_run = check_counters()) == 0) invalid_run = check_parameters(iodist_file, mix_file, runtime_val); /* print test results */ print_results(children, load, mix_file, invalid_run, runtime_val, iodist_file); /* * if multi-client execution then tell Prime client that * I'm done with 'real' work and wait for move-data message * and send data across */ if (Prime_client) { (void) fprintf(stderr, "%s Sending DONE-TEST message to Prime Client(%s).\n", lad_timestamp(), Prime_client); if ((result = (int) signal_Prime_Client("CLIENT_SIGNAL","")) == (int) RPC_SUCCESS) { (void) fprintf(stderr, "%s Completed.", lad_timestamp()); (void) fflush(stderr); } else { Saveerrno = errno; (void) fprintf(stderr, "\n"); (void) fprintf(stderr, "%s: error %d sending DONE-TEST message to Prime Client\n", sfs_Myname, result); errno = Saveerrno; perror("signal_Prime_Client"); /* cleanup and exit */ (void) generic_kill(0, SIGINT); exit(75); } /* * wait for MOVE-DATA message from Prime Client before * sending send results. */ (void) fprintf(stderr, "\n"); (void) fprintf(stderr, "%s Waiting on MOVE-DATA message from Prime Client(%s).\n", lad_timestamp(), Prime_client); (void) fflush(stderr); (void) pause(); (void) fprintf(stderr, "%s Received.", lad_timestamp()); (void) fprintf(stderr, "\n"); (void) fprintf(stderr, "%s Sending results to Prime Client(%s)\n", lad_timestamp(), Prime_client); (void) fflush(stderr); if ((result = (int) signal_Prime_Client("CLIENT_DATA", Client_results)) == (int) RPC_SUCCESS) { (void) fprintf(stderr, "%s Completed.\n", lad_timestamp()); (void) fflush(stderr); } else { Saveerrno = errno; (void) fprintf(stderr, "\n"); (void) fprintf(stderr, "%s: error %d sending client's result to Prime Client\n", sfs_Myname, result); errno = Saveerrno; perror("signal_Prime_Client"); /* cleanup and exit */ (void) generic_kill(0, SIGINT); exit(76); } } /* sent done, got move-data and sent data */ (void) fprintf(stdout,"\n"); (void) fprintf(stdout, "************************************************************************"); (void) fprintf(stdout,"\n"); } /* parent */