88 #include <sys/types.h> 95 #include <spi/UPC_Events.h> 96 #include <spi/kernel_interface.h> 131 #define DEFAULT_THRESHOLD 1000000L 144 #define EVENT_NAME_SIZE (BGP_UPC_MAXIMUM_LENGTH_EVENT_NAME + 50) 151 for (ev = BGP_UPC_MINIMUM_EVENT_ID; ev <= BGP_UPC_MAXIMUM_EVENT_ID; ev++) {
153 && strcmp(name, buf) == 0) {
173 new = strchr(desc,
':');
178 new += strspn(
new,
" \t");
216 counter = BGP_UPC_Read_Counter_Value(ev, BGP_UPC_READ_EXCLUSIVE);
218 if (counter >= threshold) {
223 BGP_UPC_Set_Counter_Value(ev, 0);
224 BGP_UPC_Set_Counter_Threshold_Value(ev, threshold);
246 BGP_UPC_Initialize();
247 if (Kernel_PhysicalProcessorID() == 0) {
248 BGP_UPC_Initialize_Counter_Config(BGP_UPC_MODE_0, BGP_UPC_CFG_EDGE_DEFAULT);
251 TMSG(UPC,
"BGP_UPC_Initialize");
271 if (self->state ==
UNINIT) {
285 int k, code, metric_id, nevents;
291 EMSG(
"unexpected failure in UPC process_event_list(): " 292 "unable to find code for event %s", event);
298 nevents =
self->evl.nevents;
301 for (k = 0; k < nevents; k++) {
303 code =
self->evl.events[k].event;
304 threshold =
self->evl.events[k].thresh;
308 self->evl.events[k].metric_id = metric_id;
309 TMSG(UPC,
"add event %s(%d), threshold %ld, metric %d",
310 name, code, threshold, metric_id);
326 if (Kernel_PhysicalProcessorID() != 0) {
327 EMSG(
"Warning: unable to sample in this process/thread " 328 "due to BlueGene hardware limitations (not core 0).");
332 for (k = 0; k <
self->evl.nevents; k++) {
333 ev =
self->evl.events[k].event;
336 ret = BGP_UPC_Set_Counter_Value(ev, 0);
338 EMSG(
"Warning: unable to sample on this node " 339 "due to BlueGene hardware limitations.");
342 ret = BGP_UPC_Set_Counter_Threshold_Value(ev, self->evl.events[k].thresh);
344 EMSG(
"Warning: unable to sample on this node " 345 "due to BlueGene hardware limitations.");
348 TMSG(UPC,
"monitor event %s(%d), threshold %ld",
349 name, ev, self->evl.events[k].thresh);
355 EEMSG(
"HPCToolkit fatal error: unable to install signal handler for SIGXCPU");
358 TMSG(UPC,
"installed signal handler for SIGXCPU");
364 if (Kernel_PhysicalProcessorID() != 0)
371 TMSG(UPC,
"BGP_UPC_Start on core 0");
382 if (Kernel_PhysicalProcessorID() != 0)
387 TMSG(UPC,
"BGP_UPC_Stop on core 0");
393 if (Kernel_PhysicalProcessorID() != 0)
398 TMSG(UPC,
"shutdown on core 0");
408 printf(
"===========================================================================\n");
409 printf(
"Available BG/P UPC events on core 0\n");
410 printf(
"===========================================================================\n");
411 printf(
"Name\t\t\t\t\tDescription\n");
412 printf(
"---------------------------------------------------------------------------\n");
415 for (ev = BGP_UPC_MINIMUM_EVENT_ID; ev <= BGP_UPC_MAXIMUM_EVENT_ID; ev++) {
417 && BGP_UPC_Get_Event_Description(ev, 2040, desc) >= 0
418 && strstr(name,
"PU0") !=
NULL) {
423 printf(
"UPC events on core 0: %d\n", num_total);
426 printf(
"===========================================================================\n");
427 printf(
"Other BG/P UPC events (not all available)\n");
428 printf(
"===========================================================================\n");
429 printf(
"Name\t\t\t\t\tDescription\n");
430 printf(
"---------------------------------------------------------------------------\n");
433 for (ev = BGP_UPC_MINIMUM_EVENT_ID; ev <= BGP_UPC_MAXIMUM_EVENT_ID; ev++) {
435 && BGP_UPC_Get_Event_Description(ev, 2040, desc) >= 0
436 && strstr(name,
"PU0") ==
NULL) {
441 printf(
"Other UPC events: %d\n", num_total);
446 #define ss_cls SS_HARDWARE
__thread bool hpcrun_thread_suppress_sample
static int bgp_event_name_to_code(const char *name)
static void hpcrun_safe_exit(void)
sample_val_t hpcrun_sample_callpath(void *context, int metricId, hpcrun_metricVal_t metricIncr, int skipInner, int isSync, sampling_info_t *data)
#define HPCTOOLKIT_APPLICATION_ERRNO_RESTORE()
static sample_source_t * myself
#define DEFAULT_THRESHOLD
static bool hpcrun_is_sampling_disabled(void)
static char * trim_event_desc(char *desc)
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)
void hpcrun_ssfail_unsupported(char *source, char *event)
char * start_tok(char *lst)
static void METHOD_FN(init)
int hpcrun_extract_ev_thresh(const char *in, int evlen, char *ev, long *th, long def)
static int hpcrun_safe_enter_async(void *pc)
#define METHOD_CALL(obj, meth,...)
static int hpcrun_upc_handler(int sig, siginfo_t *info, void *context)
static int const threshold
int hpcrun_new_metric(void)
#define HPCTOOLKIT_APPLICATION_ERRNO_SAVE()
void hpcrun_pre_allocate_metrics(size_t num)