static bool METHOD_FN(supports_event, const char *ev_str) { return hpcrun_ev_is(ev_str, ITIMER_EVENT_NAME) || hpcrun_ev_is(ev_str, WALLCLOCK_EVENT_NAME) || hpcrun_ev_is(ev_str, CPUTIME_EVENT_NAME) || hpcrun_ev_is(ev_str, REALTIME_EVENT_NAME); }
static bool METHOD_FN(supports_event,const char *ev_str) { return hpcrun_ev_is(ev_str,"NONE"); }
static void METHOD_FN(process_event_list, int lush_metrics) { char name[1024]; // local buffer needed for extract_ev_threshold TMSG(ITIMER_CTL, "process event list, lush_metrics = %d", lush_metrics); // fetch the event string for the sample source char* evlist = METHOD_CALL(self, get_event_str); char* event = start_tok(evlist); TMSG(ITIMER_CTL,"checking event spec = %s",event); if (hpcrun_ev_is(event, WALLCLOCK_EVENT_NAME)) { #ifdef HOST_SYSTEM_IBM_BLUEGENE use_itimer = true; the_event_name = WALLCLOCK_EVENT_NAME; the_metric_name = WALLCLOCK_METRIC_NAME; the_signal_num = ITIMER_SIGNAL; #else #ifdef ENABLE_CLOCK_CPUTIME use_cputime = true; the_event_name = CPUTIME_EVENT_NAME; the_metric_name = CPUTIME_METRIC_NAME; the_signal_num = REALTIME_SIGNAL; #else EEMSG("Event %s (%s) is not available on this system.", WALLCLOCK_EVENT_NAME, CPUTIME_EVENT_NAME); hpcrun_ssfail_unknown(event); #endif #endif } if (hpcrun_ev_is(event, REALTIME_EVENT_NAME)) { #ifdef ENABLE_CLOCK_REALTIME use_realtime = true; the_event_name = REALTIME_EVENT_NAME; the_metric_name = REALTIME_METRIC_NAME; the_signal_num = REALTIME_SIGNAL; #else EEMSG("Event %s is not available on this system.", REALTIME_EVENT_NAME); hpcrun_ssfail_unknown(event); #endif } if (hpcrun_ev_is(event, CPUTIME_EVENT_NAME)) { #ifdef ENABLE_CLOCK_CPUTIME use_cputime = true; the_event_name = CPUTIME_EVENT_NAME; the_metric_name = CPUTIME_METRIC_NAME; the_signal_num = REALTIME_SIGNAL; #else EEMSG("Event %s is not available on this system.", CPUTIME_EVENT_NAME); hpcrun_ssfail_unknown(event); #endif } if (hpcrun_ev_is(event, ITIMER_EVENT_NAME)) { use_itimer = true; the_event_name = ITIMER_EVENT_NAME; the_metric_name = ITIMER_METRIC_NAME; the_signal_num = ITIMER_SIGNAL; } if (!use_itimer && !use_realtime && !use_cputime) { // should never get here if supports_event is true hpcrun_ssfail_unknown(event); } // extract event threshold hpcrun_extract_ev_thresh(event, sizeof(name), name, &period, DEFAULT_PERIOD); // store event threshold METHOD_CALL(self, store_event, ITIMER_EVENT, period); TMSG(OPTIONS,"wallclock period set to %ld",period); // set up file local variables for sample source control int seconds = period / 1000000; int microseconds = period % 1000000; TMSG(ITIMER_CTL, "init %s sample_period = %ld, seconds = %d, usec = %d", the_event_name, period, seconds, microseconds); itval_start.it_value.tv_sec = seconds; itval_start.it_value.tv_usec = microseconds; itval_start.it_interval.tv_sec = 0; itval_start.it_interval.tv_usec = 0; itspec_start.it_value.tv_sec = seconds; itspec_start.it_value.tv_nsec = 1000 * microseconds; itspec_start.it_interval.tv_sec = 0; itspec_start.it_interval.tv_nsec = 0; // older versions of BG/P incorrectly delivered SIGALRM when // interval is zero. I (krentel) believe this is no longer // necessary, but it can't really hurt. #ifdef HOST_SYSTEM_IBM_BLUEGENE itval_start.it_interval.tv_sec = 3600; itspec_start.it_interval.tv_sec = 3600; #endif memset(&itval_stop, 0, sizeof(itval_stop)); memset(&itspec_stop, 0, sizeof(itspec_stop)); sigemptyset(&timer_mask); sigaddset(&timer_mask, the_signal_num); // handle metric allocation hpcrun_pre_allocate_metrics(1 + lush_metrics); int metric_id = hpcrun_new_metric(); METHOD_CALL(self, store_metric_id, ITIMER_EVENT, metric_id); // set metric information in metric table TMSG(ITIMER_CTL, "setting metric timer period = %ld", sample_period); hpcrun_set_metric_info_and_period(metric_id, the_metric_name, MetricFlags_ValFmt_Int, sample_period, metric_property_time); if (lush_metrics == 1) { int mid_idleness = hpcrun_new_metric(); lush_agents->metric_time = metric_id; lush_agents->metric_idleness = mid_idleness; hpcrun_set_metric_info_and_period(mid_idleness, IDLE_METRIC_NAME, MetricFlags_ValFmt_Real, sample_period, metric_property_time); } event = next_tok(); if (more_tok()) { EEMSG("Can't use multiple timer events in the same run."); hpcrun_ssfail_conflict("timer", event); } }