89 #define SKIP_ONE_FRAME 1 164 if (s ==
Running)
return "Running";
165 if (s ==
Spinning)
return "Spinning";
166 if (s ==
Blocked)
return "Blocked";
186 if (! pthread_blame_table) {
187 EMSG(
"Attempted to add pthread blame before initialization");
198 if (! pthread_blame_table) {
199 EMSG(
"Attempted to fetch pthread blame before initialization");
209 TMSG(LOCKWAIT,
"Processing directed blame");
216 #endif // LOCKWAIT_FIX 218 uint32_t metric_value = (uint32_t) (metric_desc->
period * metric_incr);
222 TMSG(LOCKWAIT,
"about to add %d to blame object %d", metric_incr, obj_to_blame);
226 TMSG(LOCKWAIT,
"about to add %d to %s-waiting in node %d",
254 TMSG(LOCKWAIT,
"Start directed blaming using blame structure %x, for obj %d",
263 TMSG(LOCKWAIT,
"Start directed blaming using blame structure %x, for obj %d",
273 TMSG(LOCKWAIT,
"End directed blaming for blame structure %x",
280 uint64_t blame =
get_blame((uint64_t) (uintptr_t) obj);
281 TMSG(LOCKWAIT,
"Blame obj %d accepting %d units of blame", obj, blame);
320 TMSG(LOCKWAIT,
"pthread blame ss STARTED, blame table = %x", pthread_blame_table);
371 if (! pthread_blame_table) pthread_blame_table =
blame_map_new();
384 printf(
"===========================================================================\n");
385 printf(
"Available directed blame shifting preset events\n");
386 printf(
"===========================================================================\n");
387 printf(
"Name\t\tDescription\n");
388 printf(
"---------------------------------------------------------------------------\n");
389 printf(
"%s\tShift the blame for waiting for a lock to the lock holder.\n" 390 "\t\tOnly suitable for threaded programs.\n",
402 #define ss_name directed_blame 403 #define ss_cls SS_SOFTWARE 404 #define ss_sort_order 90
static __thread blame_t pthread_blame
metric_set_t * hpcrun_reify_metric_set(cct_node_id_t cct_id)
void pthread_directed_blame_shift_spin_start(void *obj)
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)
static int get_blame_metric_id(void)
#define PTHREAD_BLOCKWAIT_METRIC
struct bs_fn_entry_t * next
static int blockwait_metric_id
#define PTHREAD_EVENT_NAME
static bs_fn_entry_t bs_entry
static bool lockwait_enabled
static int blame_metric_id
static uint64_t get_blame_target(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 pthread_directed_blame_accept(void *obj)
void blame_shift_register(bs_fn_entry_t *entry)
void pthread_directed_blame_shift_end(void)
static char * state2str(state_t s)
uint64_t blame_map_get_blame(blame_entry_t table[], uint64_t obj)
bool pthread_blame_lockwait_enabled(void)
void blame_map_add_blame(blame_entry_t table[], uint64_t obj, uint32_t metric_value)
static void process_directed_blame_for_sample(void *arg, int metric_id, cct_node_t *node, int metric_incr)
int32_t hpcrun_cct_persistent_id(cct_node_t *x)
#define PTHREAD_SPINWAIT_METRIC
static bool metric_id_set
void pthread_directed_blame_shift_blocked_start(void *obj)
int metrics[MAX_EVENTS][MAX_METRICS]
int hpcrun_new_metric(void)
#define PTHREAD_BLAME_METRIC
blame_entry_t * blame_map_new(void)
metric_desc_properties_t properties
static uint64_t get_blame(uint64_t obj)
void hpcrun_metric_std_inc(int metric_id, metric_set_t *set, hpcrun_metricVal_t incr)
static int spinwait_metric_id
static void METHOD_FN(init)
static int hpcrun_safe_enter(void)
static blame_entry_t * pthread_blame_table
static void add_blame(uint64_t obj, uint32_t value)
metric_desc_t * hpcrun_id2metric(int metric_id)
#define metric_property_none