HPCToolkit
pthread-blame.c File Reference
#include <ucontext.h>
#include <pthread.h>
#include <string.h>
#include <dlfcn.h>
#include <stdbool.h>
#include "simple_oo.h"
#include "sample_source_obj.h"
#include "common.h"
#include "pthread-blame.h"
#include <sample-sources/blame-shift/blame-shift.h>
#include <sample-sources/blame-shift/blame-map.h>
#include <hpcrun/cct2metrics.h>
#include <hpcrun/metrics.h>
#include <hpcrun/hpctoolkit.h>
#include <hpcrun/safe-sampling.h>
#include <hpcrun/sample_event.h>
#include <hpcrun/thread_data.h>
#include <hpcrun/cct/cct.h>
#include <messages/messages.h>
#include <stdio.h>
#include "ss_obj.h"
Include dependency graph for pthread-blame.c:

Go to the source code of this file.

Classes

struct  blame_t
 
struct  dbg_t
 
struct  dbg_tr_t
 

Macros

#define SKIP_ONE_FRAME   1
 
#define ss_name   directed_blame
 
#define ss_cls   SS_SOFTWARE
 
#define ss_sort_order   90
 

Typedefs

typedef struct dbg_t dbg_t
 
typedef struct dbg_tr_t dbg_tr_t
 

Enumerations

enum  state_t { Running, Spinning, Blocked }
 

Functions

static uint64_t get_blame_target (void)
 
static char * state2str (state_t s)
 
static int get_blame_metric_id (void)
 
static void add_blame (uint64_t obj, uint32_t value)
 
static uint64_t get_blame (uint64_t obj)
 
static void process_directed_blame_for_sample (void *arg, int metric_id, cct_node_t *node, int metric_incr)
 
bool pthread_blame_lockwait_enabled (void)
 
void pthread_directed_blame_shift_blocked_start (void *obj)
 
void pthread_directed_blame_shift_spin_start (void *obj)
 
void pthread_directed_blame_shift_end (void)
 
void pthread_directed_blame_accept (void *obj)
 
static void METHOD_FN (init)
 
static void METHOD_FN (thread_init)
 
static void METHOD_FN (thread_init_action)
 
static void METHOD_FN (start)
 
static void METHOD_FN (thread_fini_action)
 
static void METHOD_FN (stop)
 
static void METHOD_FN (shutdown)
 
static bool METHOD_FN (supports_event, const char *ev_str)
 
static void METHOD_FN (process_event_list, int lush_metrics)
 
static void METHOD_FN (gen_event_set, int lush_metrics)
 
static void METHOD_FN (display_events)
 

Variables

static int blame_metric_id = -1
 
static int blockwait_metric_id = -1
 
static int spinwait_metric_id = -1
 
static bs_fn_entry_t bs_entry
 
static bool lockwait_enabled = false
 
static blame_entry_tpthread_blame_table = NULL
 
static bool metric_id_set = false
 
static __thread blame_t pthread_blame = {0, Running}
 

Macro Definition Documentation

◆ SKIP_ONE_FRAME

#define SKIP_ONE_FRAME   1

Definition at line 89 of file pthread-blame.c.

◆ ss_cls

#define ss_cls   SS_SOFTWARE

Definition at line 403 of file pthread-blame.c.

◆ ss_name

#define ss_name   directed_blame

Definition at line 402 of file pthread-blame.c.

◆ ss_sort_order

#define ss_sort_order   90

Definition at line 404 of file pthread-blame.c.

Typedef Documentation

◆ dbg_t

typedef struct dbg_t dbg_t

◆ dbg_tr_t

typedef struct dbg_tr_t dbg_tr_t

Enumeration Type Documentation

◆ state_t

enum state_t
Enumerator
Running 
Spinning 
Blocked 

Definition at line 97 of file pthread-blame.c.

Function Documentation

◆ add_blame()

static void add_blame ( uint64_t  obj,
uint32_t  value 
)
inlinestatic

Definition at line 184 of file pthread-blame.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_blame()

static uint64_t get_blame ( uint64_t  obj)
inlinestatic

Definition at line 196 of file pthread-blame.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_blame_metric_id()

static int get_blame_metric_id ( void  )
inlinestatic

Definition at line 173 of file pthread-blame.c.

Here is the caller graph for this function:

◆ get_blame_target()

static uint64_t get_blame_target ( void  )
inlinestatic

Definition at line 154 of file pthread-blame.c.

Here is the caller graph for this function:

◆ METHOD_FN() [1/11]

static void METHOD_FN ( init  )
static

Definition at line 298 of file pthread-blame.c.

◆ METHOD_FN() [2/11]

static void METHOD_FN ( thread_init  )
static

Definition at line 305 of file pthread-blame.c.

◆ METHOD_FN() [3/11]

static void METHOD_FN ( thread_init_action  )
static

Definition at line 311 of file pthread-blame.c.

◆ METHOD_FN() [4/11]

static void METHOD_FN ( start  )
static

Definition at line 317 of file pthread-blame.c.

◆ METHOD_FN() [5/11]

static void METHOD_FN ( thread_fini_action  )
static

Definition at line 325 of file pthread-blame.c.

◆ METHOD_FN() [6/11]

static void METHOD_FN ( stop  )
static

Definition at line 331 of file pthread-blame.c.

◆ METHOD_FN() [7/11]

static void METHOD_FN ( shutdown  )
static

Definition at line 336 of file pthread-blame.c.

◆ METHOD_FN() [8/11]

static bool METHOD_FN ( supports_event  ,
const char *  ev_str 
)
static

Definition at line 344 of file pthread-blame.c.

◆ METHOD_FN() [9/11]

static void METHOD_FN ( process_event_list  ,
int  lush_metrics 
)
static

Definition at line 351 of file pthread-blame.c.

Here is the call graph for this function:

◆ METHOD_FN() [10/11]

static void METHOD_FN ( gen_event_set  ,
int  lush_metrics 
)
static

Definition at line 376 of file pthread-blame.c.

◆ METHOD_FN() [11/11]

static void METHOD_FN ( display_events  )
static

Definition at line 382 of file pthread-blame.c.

◆ process_directed_blame_for_sample()

static void process_directed_blame_for_sample ( void *  arg,
int  metric_id,
cct_node_t node,
int  metric_incr 
)
static

Definition at line 207 of file pthread-blame.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pthread_blame_lockwait_enabled()

bool pthread_blame_lockwait_enabled ( void  )

Definition at line 243 of file pthread-blame.c.

Here is the caller graph for this function:

◆ pthread_directed_blame_accept()

void pthread_directed_blame_accept ( void *  obj)

Definition at line 278 of file pthread-blame.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pthread_directed_blame_shift_blocked_start()

void pthread_directed_blame_shift_blocked_start ( void *  obj)

Definition at line 252 of file pthread-blame.c.

Here is the caller graph for this function:

◆ pthread_directed_blame_shift_end()

void pthread_directed_blame_shift_end ( void  )

Definition at line 270 of file pthread-blame.c.

Here is the caller graph for this function:

◆ pthread_directed_blame_shift_spin_start()

void pthread_directed_blame_shift_spin_start ( void *  obj)

Definition at line 261 of file pthread-blame.c.

Here is the caller graph for this function:

◆ state2str()

static char* state2str ( state_t  s)
inlinestatic

Definition at line 162 of file pthread-blame.c.

Here is the caller graph for this function:

Variable Documentation

◆ blame_metric_id

int blame_metric_id = -1
static

Definition at line 115 of file pthread-blame.c.

◆ blockwait_metric_id

int blockwait_metric_id = -1
static

Definition at line 116 of file pthread-blame.c.

◆ bs_entry

bs_fn_entry_t bs_entry
static

Definition at line 119 of file pthread-blame.c.

◆ lockwait_enabled

bool lockwait_enabled = false
static

Definition at line 121 of file pthread-blame.c.

◆ metric_id_set

bool metric_id_set = false
static

Definition at line 125 of file pthread-blame.c.

◆ pthread_blame

__thread blame_t pthread_blame = {0, Running}
static

Definition at line 144 of file pthread-blame.c.

◆ pthread_blame_table

blame_entry_t* pthread_blame_table = NULL
static

Definition at line 123 of file pthread-blame.c.

◆ spinwait_metric_id

int spinwait_metric_id = -1
static

Definition at line 117 of file pthread-blame.c.