83 #define LUSHCB_DECL(FN) \ 84 LUSH ## FN ## _fn_t FN 128 LUSHCB_malloc_fn_t malloc_fn,
129 LUSHCB_free_fn_t free_fn,
130 LUSHCB_step_fn_t step_fn,
131 LUSHCB_loadmap_find_fn_t loadmap_fn)
135 CB_malloc = malloc_fn;
138 CB_loadmap_find = loadmap_fn;
172 char buffer[PATH_MAX];
180 void *lm_beg, *lm_end;
181 int ret = CB_loadmap_find(addr, lm_name, &lm_beg, &lm_end);
192 void *lm_beg, *lm_end;
193 int ret = CB_loadmap_find(addr, lm_name, &lm_beg, &lm_end);
194 if (ret && !(strstr(lm_name,
lib_str) || strstr(lm_name,
ld_str))) {
275 default:
EEMSG(
"FIXME: default case (assert)\n");
279 EEMSG(
"FIXME: Unknown segment! (assert)\n");
312 #define SET_LIP_AND_TY(cl, lip, ty) \ 314 cilk_ip_set(lip, ip_normalized_NULL_lval); \ 315 ty = LUSH_STEP_END_CHORD; \ 320 ip_normalized_t ip = \ 321 hpcrun_normalize_ip(CILKFRM_PROC(cl->frame) + 1, NULL); \ 322 cilk_ip_set(lip, ip); \ 323 ty = LUSH_STEP_CONT; \ 393 CilkWorkerState* ws =
394 (CilkWorkerState*)pthread_getspecific(CILK_WorkerState_key);
404 if (CILK_WS_has_stolen(ws) && !cactus_stack) {
433 EEMSG(
"FIXME: HOW TO HANDLE MULTIPLE AGENTS?\n");
439 memset(lip, 0,
sizeof(*lip));
457 char buffer[PATH_MAX];
474 else if (is_cilkrt) {
483 EEMSG(
"FIXME: (assert): neither cilkrt nor user\n");
488 if ( !(is_user || is_cilkrt) ) {
490 EEMSG(
"FIXME: Unknown segment for master (assert)\n");
494 EEMSG(
"FIXME: Unknown thread type! (assert)\n");
558 bool*
doMetric,
bool* doMetricIdleness,
559 uint64_t* incrMetric,
double* incrMetricIdleness)
564 CilkWorkerState* ws =
565 (CilkWorkerState*)pthread_getspecific(CILK_WorkerState_key);
566 bool isWorking = (ws && CILK_WS_is_working(ws));
569 double n = CILK_WS_num_workers(ws);
570 double n_working = (double)CILK_Threads_Working;
571 double n_not_working = n - n_working;
575 double idleness = 0.0;
577 idleness = ((double)incrMetricIn * n_not_working) / n_working;
581 *doMetricIdleness =
true;
582 *incrMetric = incrMetricIn;
583 *incrMetricIdleness = idleness;
587 *doMetricIdleness =
false;
#define lush_agentid_NULL
lush_step_t LUSHI_step_bichord(lush_cursor_t *cursor)
char * LUSHI_strerror(int code)
static lush_lip_t * lush_cursor_get_lip(lush_cursor_t *cursor)
static lush_agentid_t lush_cursor_get_aid_prev(lush_cursor_t *cursor)
static volatile CilkStackFrame ** CILKWS_FRAME_DEQ_TAIL(CilkWorkerState *x)
lush_step_t LUSHI_step_lnote(lush_cursor_t *cursor)
int LUSHI_init(int argc, char **argv, lush_agentid_t aid, LUSHCB_malloc_fn_t malloc_fn, LUSHCB_free_fn_t free_fn, LUSHCB_step_fn_t step_fn, LUSHCB_loadmap_find_fn_t loadmap_fn)
bool LUSHI_do_metric(uint64_t incrMetricIn, bool *doMetric, bool *doMetricIdleness, uint64_t *incrMetric, double *incrMetricIdleness)
bool LUSHI_ismycode(void *addr)
static bool unw_ty_is_worker(unw_ty_t ty)
#define SET_LIP_AND_TY(cl, lip, ty)
struct cilk_cursor::@13 u
static void cilk_ip_set(cilk_ip_t *x, ip_normalized_t ip)
static int init_lcursor(lush_cursor_t *cursor)
static void csr_unset_flag(cilk_cursor_t *csr, unw_flg_t flg)
static unw_seg_t classify_by_unw_segment(cilk_cursor_t *csr)
static void * lush_cursor_get_ip_unnorm(lush_cursor_t *cursor)
static const char * libcilk_str
lush_step_t LUSHI_step_pnote(lush_cursor_t *cursor)
static bool is_cilkprogram(void *addr, char *lm_buffer)
static Closure * CILKWS_CL_DEQ_BOT(CilkWorkerState *x)
static bool is_libcilk(void *addr, char *lm_buffer)
static bool lush_assoc_is_a_to_0(lush_assoc_t as)
int LUSHI_set_active_frame_marker()
#define doMetric(metricIdExpr, metricIncr, type)
ip_normalized_t ref_ip_norm
static ip_normalized_t lush_cursor_get_ip_norm(lush_cursor_t *cursor)
static volatile CilkStackFrame ** CILKWS_FRAME_DEQ_HEAD(CilkWorkerState *x)
static unw_seg_t peek_segment(lush_cursor_t *cursor)
static void csr_set_flag(cilk_cursor_t *csr, unw_flg_t flg)
int LUSHI_lip_eq(lush_lip_t *lip)
CilkWorkerState * cilk_worker_state
enum lush_step lush_step_t
static void lush_cursor_set_assoc(lush_cursor_t *cursor, lush_assoc_t as)
enum lush_assoc lush_assoc_t
static lush_assoc_t lush_cursor_get_assoc(lush_cursor_t *cursor)
static const char * ld_str
static lush_agentid_t MY_lush_aid
static hpcrun_unw_cursor_t * lush_cursor_get_pcursor(lush_cursor_t *cursor)
int LUSHI_lip_destroy(lush_lip_t *lip)
static const char * lib_str
<!-- ********************************************************************--> n<!-- HPCToolkit Experiment DTD --> n<!-- Version 2.1 --> n<!-- ********************************************************************--> n<!ELEMENT HPCToolkitExperiment(Header,(SecCallPathProfile|SecFlatProfile) *)> n<!ATTLIST HPCToolkitExperiment\n version CDATA #REQUIRED > n n<!-- ******************************************************************--> n n<!-- Info/NV:flexible name-value pairs:(n) ame;(t) ype;(v) alue --> n<!ELEMENT Info(NV *)> n<!ATTLIST Info\n n CDATA #IMPLIED > n<!ELEMENT NV EMPTY > n<!ATTLIST NV\n n CDATA #REQUIRED\n t CDATA #IMPLIED\n v CDATA #REQUIRED > n n<!-- ******************************************************************--> n<!-- Header --> n<!-- ******************************************************************--> n<!ELEMENT Header(Info *)> n<!ATTLIST Header\n n CDATA #REQUIRED > n n<!-- ******************************************************************--> n<!-- Section Header --> n<!-- ******************************************************************--> n<!ELEMENT SecHeader(MetricTable?, MetricDBTable?, TraceDBTable?, LoadModuleTable?, FileTable?, ProcedureTable?, Info *)> n n<!-- MetricTable:--> n<!ELEMENT MetricTable(Metric) * > n n<!-- Metric:(i) d;(n) ame --> n<!--(v) alue-type:transient type of values --> n<!--(t) ype:persistent type of metric --> n<!-- fmt:format;show;--> n<!ELEMENT Metric(MetricFormula *, Info?)> n<!ATTLIST Metric\n i CDATA #REQUIRED\n n CDATA #REQUIRED\n es CDATA #IMPLIED\n em CDATA #IMPLIED\n ep CDATA #IMPLIED\n v(raw|final|derived-incr|derived) \"raw\\ t (inclusive|exclusive|nil) \nil\\ partner CDATA #IMPLIED\ fmt CDATA #IMPLIED\ show (1|0) \1\\ show-percent (1|0) \1> n n<!-- MetricFormula represents derived metrics: (t)ype; (frm): formula --> n<!ELEMENT MetricFormula (Info?)> n<!ATTLIST MetricFormula\ t (combine|finalize) \finalize\\ i CDATA #IMPLIED\ frm CDATA #REQUIRED> n n<!-- Metric data, used in sections: (n)ame [from Metric]; (v)alue --> n<!ELEMENT M EMPTY> n<!ATTLIST M\ n CDATA #REQUIRED\ v CDATA #REQUIRED> n n<!-- MetricDBTable: --> n<!ELEMENT MetricDBTable (MetricDB)*> n n<!-- MetricDB: (i)d; (n)ame --> n<!-- (t)ype: persistent type of metric --> n<!-- db-glob: file glob describing files in metric db --> n<!-- db-id: id within metric db --> n<!-- db-num-metrics: number of metrics in db --> n<!-- db-header-sz: size (in bytes) of a db file header --> n<!ELEMENT MetricDB EMPTY> n<!ATTLIST MetricDB\ i CDATA #REQUIRED\ n CDATA #REQUIRED\ t (inclusive|exclusive|nil) \nil\\ partner CDATA #IMPLIED\ db-glob CDATA #IMPLIED\ db-id CDATA #IMPLIED\ db-num-metrics CDATA #IMPLIED\ db-header-sz CDATA #IMPLIED> n n<!-- TraceDBTable: --> n<!ELEMENT TraceDBTable (TraceDB)> n n<!-- TraceDB: (i)d --> n<!-- db-min-time: min beginning time stamp (global) --> n<!-- db-max-time: max ending time stamp (global) --> n<!ELEMENT TraceDB EMPTY> n<!ATTLIST TraceDB\ i CDATA #REQUIRED\ db-glob CDATA #IMPLIED\ db-min-time CDATA #IMPLIED\ db-max-time CDATA #IMPLIED\ db-header-sz CDATA #IMPLIED> n n<!-- LoadModuleTable assigns a short name to a load module --> n<!ELEMENT LoadModuleTable (LoadModule)*> n n<!ELEMENT LoadModule (Info?)> n<!ATTLIST LoadModule\ i CDATA #REQUIRED\ n CDATA #REQUIRED> n n<!-- FileTable assigns a short name to a file --> n<!ELEMENT FileTable (File)*> n n<!ELEMENT File (Info?)> n<!ATTLIST File\ i CDATA #REQUIRED\ n CDATA #REQUIRED> n n<!-- ProcedureTable assigns a short name to a procedure --> n<!ELEMENT ProcedureTable (Procedure)*> n n<!-- Info/NV: flexible name-value pairs: (n)ame; (t)ype; (v)alue --> n<!-- f: family of the procedure (fake, root, ...)--> n<!ELEMENT Procedure (Info?)> n<!ATTLIST Procedure\ i CDATA #REQUIRED\ n CDATA #REQUIRED\ f CDATA #IMPLIED> n n<!-- ****************************************************************** --> n<!-- Section: Call path profile --> n<!-- ****************************************************************** --> n<!ELEMENT SecCallPathProfile (SecHeader, SecCallPathProfileData)> n<!ATTLIST SecCallPathProfile\ i CDATA #REQUIRED\ n CDATA #REQUIRED> n n<!ELEMENT SecCallPathProfileData (PF|M)*> n<!-- Procedure frame --> n<!-- (i)d: unique identifier for cross referencing --> n<!-- (s)tatic scope id --> n<!-- (n)ame: a string or an id in ProcedureTable --> n<!-- (lm) load module: a string or an id in LoadModuleTable --> n<!-- (f)ile name: a string or an id in LoadModuleTable --> n<!-- (l)ine range: \beg-end\ (inclusive range) --> n<!-- (a)lien: whether frame is alien to enclosing P --> n<!-- (str)uct: hpcstruct node id --> n<!-- (t)ype: hpcrun node type: memory access, variable declaration, ... --> n<!-- (v)ma-range-set: \{[beg-end), [beg-end)...}\ --> n<!ELEMENT PF (PF|Pr|L|C|S|M)*> n<!ATTLIST PF\ i CDATA #IMPLIED\ s CDATA #IMPLIED\ n CDATA #REQUIRED\ lm CDATA #IMPLIED\ f CDATA #IMPLIED\ l CDATA #IMPLIED\ str CDATA #IMPLIED\ v CDATA #IMPLIED> n<!-- Procedure (static): GOAL: replace with 'P' --> n<!ELEMENT Pr (Pr|L|C|S|M)*> n<!ATTLIST Pr\ i CDATA #IMPLIED\ s CDATA #IMPLIED\ n CDATA #REQUIRED\ lm CDATA #IMPLIED\ f CDATA #IMPLIED\ l CDATA #IMPLIED\ a (1|0) \0\\ str CDATA #IMPLIED\ v CDATA #IMPLIED> n<!-- Callsite (a special StatementRange) --> n<!ELEMENT C (PF|M)*> n<!ATTLIST C\ i CDATA #IMPLIED\ s CDATA #IMPLIED\ l CDATA #IMPLIED\ str CDATA #IMPLIED\ v CDATA #IMPLIED> n n<!-- ****************************************************************** --> n<!-- Section: Flat profile --> n<!-- ****************************************************************** --> n<!ELEMENT SecFlatProfile (SecHeader, SecFlatProfileData)> n<!ATTLIST SecFlatProfile\ i CDATA #REQUIRED\ n CDATA #REQUIRED> n n<!ELEMENT SecFlatProfileData (LM|M)*> n<!-- Load module: (i)d; (n)ame; (v)ma-range-set --> n<!ELEMENT LM (F|P|M)*> n<!ATTLIST LM\ i CDATA #IMPLIED\ n CDATA #REQUIRED\ v CDATA #IMPLIED> n<!-- File --> n<!ELEMENT F (P|L|S|M)*> n<!ATTLIST F\ i CDATA #IMPLIED\ n CDATA #REQUIRED> n<!-- Procedure (Note 1) --> n<!ELEMENT P (P|A|L|S|C|M)*> n<!ATTLIST P\ i CDATA #IMPLIED\ n CDATA #REQUIRED\ l CDATA #IMPLIED\ str CDATA #IMPLIED\ v CDATA #IMPLIED> n<!-- Alien (Note 1) --> n<!ELEMENT A (A|L|S|C|M)*> n<!ATTLIST A\ i CDATA #IMPLIED\ f CDATA #IMPLIED\ n CDATA #IMPLIED\ l CDATA #IMPLIED\ str CDATA #IMPLIED\ v CDATA #IMPLIED> n<!-- Loop (Note 1,2) --> n<!ELEMENT L (A|Pr|L|S|C|M)*> n<!ATTLIST L\ i CDATA #IMPLIED\ s CDATA #IMPLIED\ l CDATA #IMPLIED\ f CDATA #IMPLIED\ str CDATA #IMPLIED\ v CDATA #IMPLIED> n<!-- Statement (Note 2) --> n<!-- (it): trace record identifier --> n<!ELEMENT S (S|M)*> n<!ATTLIST S\ i CDATA #IMPLIED\ it CDATA #IMPLIED\ s CDATA #IMPLIED\ l CDATA #IMPLIED\ str CDATA #IMPLIED\ v CDATA #IMPLIED> n<!-- Note 1: Contained Cs may not contain PFs --> n<!-- Note 2: The 's' attribute is not used for flat profiles --> n
static bool csr_is_flag(cilk_cursor_t *csr, unw_flg_t flg)
static lush_lcursor_t * lush_cursor_get_lcursor(lush_cursor_t *cursor)
static bool unw_ty_is_master(unw_ty_t ty)