103 #if defined(CATAMOUNT) 104 # define HPCRUN_PROFILE_SIGNAL SIGALRM 105 # define HPCRUN_PROFILE_TIMER ITIMER_REAL 107 # define HPCRUN_PROFILE_SIGNAL SIGPROF 108 # define HPCRUN_PROFILE_TIMER ITIMER_PROF 111 #define SECONDS_PER_HOUR 3600 113 #if !defined(HOST_SYSTEM_IBM_BLUEGENE) 114 # define USE_ELAPSED_TIME_FOR_WALLCLOCK 117 #define RESET_ITIMER_EACH_SAMPLE 119 #if defined(RESET_ITIMER_EACH_SAMPLE) 121 # if defined(HOST_SYSTEM_IBM_BLUEGENE) 128 # define AUTOMATIC_ITIMER_RESET_SECONDS(x) (SECONDS_PER_HOUR) 129 # define AUTOMATIC_ITIMER_RESET_MICROSECONDS(x) (0) 130 # else // !defined(HOST_SYSTEM_IBM_BLUEGENE) 131 # define AUTOMATIC_ITIMER_RESET_SECONDS(x) (0) 132 # define AUTOMATIC_ITIMER_RESET_MICROSECONDS(x) (0) 133 # endif // !defined(HOST_SYSTEM_IBM_BLUEGENE) 135 #else // !defined(RESET_ITIMER_EACH_SAMPLE) 137 # define AUTOMATIC_ITIMER_RESET_SECONDS(x) (x) 138 # define AUTOMATIC_ITIMER_RESET_MICROSECONDS(x) (x) 140 #endif // !defined(RESET_ITIMER_EACH_SAMPLE) 142 #define DEFAULT_THRESHOLD 5000L 209 TMSG(_TST_CTL,
"starting _tst w value = (%d,%d), interval = (%d,%d)",
210 itimer.it_interval.tv_sec,
211 itimer.it_interval.tv_usec,
216 EMSG(
"setitimer failed (%d): %s", errno, strerror(errno));
220 #ifdef USE_ELAPSED_TIME_FOR_WALLCLOCK 223 EMSG(
"time_getTimeCPU (clock_gettime) failed!");
243 TMSG(ITIMER_CTL,
"stopping _tst");
274 TMSG(_TST_CTL,
"checking event spec = %s",event);
281 TMSG(OPTIONS,
"_TST period set to %ld",
period);
284 int seconds =
period / 1000000;
285 int microseconds =
period % 1000000;
287 TMSG(OPTIONS,
"init timer w sample_period = %ld, seconds = %ld, usec = %ld",
288 period, seconds, microseconds);
291 itimer.it_value.tv_sec = seconds;
292 itimer.it_value.tv_usec = microseconds;
306 #ifdef USE_ELAPSED_TIME_FOR_WALLCLOCK 307 # define sample_period 1 309 # define sample_period period 316 if (lush_metrics == 1) {
328 EMSG(
"MULTIPLE _TST events detected! Using first event spec: %s");
354 #ifdef DISPLAY_TEST_EVENTS 355 printf(
"===========================================================================\n");
356 printf(
"Available _tst events\n");
357 printf(
"===========================================================================\n");
358 printf(
"Name\t\tDescription\n");
359 printf(
"---------------------------------------------------------------------------\n");
360 printf(
"WALLCLOCK\tWall clock time used by the process in microseconds\n");
370 #define ss_cls SS_HARDWARE 390 TMSG(_TST_HANDLER,
"_Tst sample event");
392 uint64_t metric_incr = 1;
393 #ifdef USE_ELAPSED_TIME_FOR_WALLCLOCK 394 uint64_t cur_time_us;
397 EMSG(
"time_getTimeCPU (clock_gettime) failed!");
400 metric_incr = cur_time_us -
TD_GET(last_time_us);
407 TMSG(SPECIAL,
"No _tst restart, due to disabled sampling");
414 #ifdef RESET_ITIMER_EACH_SAMPLE
static const struct itimerval zerotimer
#define AUTOMATIC_ITIMER_RESET_SECONDS(x)
#define HPCTOOLKIT_APPLICATION_ERRNO_RESTORE()
static void METHOD_FN(init)
static bool hpcrun_is_sampling_disabled(void)
cct_node_t * hpcrun_sample_callpath_w_bt(void *context, int metricId, uint64_t metricIncr, bt_mut_fn bt_fn, bt_fn_arg arg, int isSync)
bool(* hpcrun_td_avail)(void)
void hpcrun_stats_num_samples_blocked_async_inc(void)
metric_desc_t * hpcrun_set_metric_info_and_period(int metric_id, const char *name, MetricFlags_ValFmt_t valFmt, size_t period, metric_desc_properties_t prop)
static int time_getTimeCPU(uint64_t *time)
char * start_tok(char *lst)
void hpcrun_ssfail_start(char *source)
bool hpcrun_ev_is(const char *candidate, const char *event_name)
#define DEFAULT_THRESHOLD
#define HPCRUN_PROFILE_TIMER
static sigset_t sigset_itimer
int hpcrun_extract_ev_thresh(const char *in, int evlen, char *ev, long *th, long def)
static int hpcrun_safe_enter_async(void *pc)
int hpcrun_event2metric(sample_source_t *ss, int event_idx)
static struct itimerval itimer
#define METHOD_CALL(obj, meth,...)
int hpcrun_new_metric(void)
#define HPCTOOLKIT_APPLICATION_ERRNO_SAVE()
void hpcrun_pre_allocate_metrics(size_t num)
void * hpcrun_context_pc(void *context)
#define AUTOMATIC_ITIMER_RESET_MICROSECONDS(x)
static int _tst_signal_handler(int sig, siginfo_t *siginfo, void *context)
lush_agent_pool_t * lush_agents
#define HPCRUN_PROFILE_SIGNAL
#define metric_property_none