87 #include <sys/types.h> 91 #include <include/hpctoolkit-config.h> 99 extern unsigned long monitor_gettid();
151 #define OPEN_OUTPUTFILE_AT_BEG 1 168 if (
opt_debug >= 1) {
MSG0(stderr,
"*** init_library ***"); }
185 static int is_finalized = 0;
187 if (
opt_debug >= 1) {
MSG0(stderr,
"*** fini_library (skip) ***"); }
192 if (
opt_debug >= 1) {
MSG0(stderr,
"*** fini_library ***"); }
200 char *env_debug = getenv(
"HPCRUN_DEBUG");
201 opt_debug = (env_debug ? atoi(env_debug) : 0);
208 char *env_recursive, *env_thread, *env_eventlist, *env_outpath, *env_flags;
209 int is_opt_file, is_opt_prefix, is_opt_dir;
210 is_opt_file = is_opt_prefix = is_opt_dir = 0;
213 char *
opts = getenv(
"HPCRUN_OPTIONS");
214 if (opts && (strlen(opts)>0)) {
215 char*
tmp = strtok(opts,
", ");
218 if (strcmp(tmp,
"USER") == 0)
220 else if (strcmp(tmp,
"KERNEL") == 0)
221 domain |= PAPI_DOM_KERNEL;
222 else if (strcmp(tmp,
"OTHER") == 0)
224 else if (strcmp(tmp,
"SUPERVISOR") == 0)
225 domain |= PAPI_DOM_SUPERVISOR;
226 else if (strcmp(tmp,
"FILE") == 0)
228 else if (strcmp(tmp,
"PREFIX") == 0)
230 else if (strcmp(tmp,
"DIR") == 0)
232 }
while ((tmp = strtok(
NULL,
",")) !=
NULL);
237 MSGx(stderr,
" LD_PRELOAD: %s", getenv(
"LD_PRELOAD"));
241 env_recursive = getenv(
"HPCRUN_RECURSIVE");
245 unsetenv(
"LD_PRELOAD");
254 env_thread = getenv(
"HPCRUN_THREAD");
261 env_eventlist = getenv(
"HPCRUN_EVENT_LIST");
269 env_outpath = getenv(
"HPCRUN_OUTPUT");
270 if (is_opt_dir && env_outpath) {
273 if (errno != EEXIST) {
281 if (is_opt_prefix && env_outpath)
285 if (is_opt_file && env_outpath)
286 strncpy(
opt_file, env_outpath, PATH_MAX);
293 env_flags = getenv(
"HPCRUN_EVENT_FLAG");
296 token = strtok_r(env_flags,
",:",&ptr);
299 DIEx(
"error: Invalid profiling flag '%s'.", token);
305 token = strtok_r(
NULL,
",:",&ptr);
329 if (
opt_debug >= 1) {
MSGx(stderr,
"*** catching signal %d ***", sig); }
331 signal(sig, SIG_DFL);
339 MSGx(stderr,
"warning: Handling unknown signal %d.", sig);
346 signal(SIGABRT, SIG_DFL);
395 char* eventnm, uint64_t
period);
406 char* eventnm, uint64_t
period);
432 if (getenv(
"HPCRUN_WAIT")){
436 if (
opt_debug >= 1) {
MSG0(stderr,
"*** init_process ***"); }
457 if (hpc_profdesc ==
NULL) {
458 DIE0(
"dlopen before process initialization!");
499 if (
opt_debug >= 1) {
MSG0(stderr,
"*** dlopen handling complete ***"); }
523 #if (OPEN_OUTPUTFILE_AT_BEG) 550 char* tok, *tmp_eventlist;
558 for (tok = strtok(tmp_eventlist,
";"); (tok !=
NULL);
559 tok = strtok((
char*)
NULL,
";")) {
582 int xprofidx = -1, yprofidx = -1;
583 const uint eventbufSZ = 128;
584 char eventbuf[eventbufSZ+1];
585 char* tok, *tmp_eventlist;
589 MSG0(stderr,
"Initializing profile descriptors");
590 MSGx(stderr,
" Found %d sys events and %d PAPI events",
591 numSysEv, numPapiEv);
595 if (numSysEv > 0 && numPapiEv > 0) {
596 DIE0(
"Cannot profile both WALLCLK and PAPI events at the same time. (Both use SIGPROF.)");
607 DIE0(
"Cannot profile WALLCLK on multithreaded process. (sprofil() limitation.)");
613 int numHwCntrs = PAPI_num_hwctrs();
614 if (numPapiEv > numHwCntrs) {
615 MSGx(stderr,
"warning: Too many events (%d) for hardware counters (%d). Only using first %d events.", numPapiEv, numHwCntrs, numHwCntrs);
616 numPapiEv = numHwCntrs;
623 if (!(*profdesc)) {
DIE0(
"error: malloc() failed!"); }
632 DIE0(
"error: malloc() failed!");
640 DIE0(
"error: malloc() failed!");
651 DIE0(
"error: malloc() failed!");
659 DIE0(
"error: malloc() failed!");
665 if (rval != PAPI_OK) {
666 DIEx(
"error: PAPI_create_eventset (%d): %s.", rval, PAPI_strerror(rval));
674 tok = strtok(tmp_eventlist,
";");
675 for (i = 0; (tok !=
NULL); i++, tok = strtok((
char*)
NULL,
";")) {
684 dlm = strrchr(tok,
':');
686 if (isdigit(dlm[1])) {
687 uint len =
MIN(dlm - tok, eventbufSZ);
688 strncpy(eventbuf, tok, len);
689 eventbuf[len] =
'\0';
696 strncpy(eventbuf, tok, eventbufSZ);
697 eventbuf[eventbufSZ] =
'\0';
711 period = strtol(dlm+1, (
char **)NULL, 10);
713 else if (evty == 1) {
716 else if (evty == 2) {
721 MSGx(stderr,
" Event: '%s' (%d) '%"PRIu64
"'", eventbuf, evty, period);
730 else if (evty == 2) {
736 DIE0(
"error: internal programming error - invalid event.");
767 for (i = 0; i < numEv; ++i) {
769 uint sprofbufsz =
sizeof(
struct prof) * rtmap->
count;
772 if (sharedprofdesc) {
778 if (!prof->
sprofs) {
DIE0(
"error: malloc() failed!"); }
779 memset(prof->
sprofs, 0x00, sprofbufsz);
784 MSGx(stderr,
"profile buffer details for %s:", prof->
ename);
785 MSGx(stderr,
" count = %d, sp=%"PRIu64
" ef=%d",
789 if (sharedprofdesc) {
793 for (mapi = 0; mapi < rtmap->
count; ++mapi) {
803 prof->
sprofs[mapi].pr_size = bufsz;
804 if (!prof->
sprofs[mapi].pr_base) {
805 DIE0(
"error: malloc() failed!");
807 memset(prof->
sprofs[mapi].pr_base, 0x00, bufsz);
815 MSGx(stderr,
"\tprofile[%d] base = %p size = %#"PRIxPTR
" off = %#"PRIxPTR
" scale = %#lx",
816 mapi, prof->
sprofs[mapi].pr_base, prof->
sprofs[mapi].pr_size,
817 prof->
sprofs[mapi].pr_off, prof->
sprofs[mapi].pr_scale);
831 for (i = 0; i < numEv; ++i) {
833 uint sprofbufsz =
sizeof(
struct prof) * rtmap->
count;
837 if (!sharedprofdesc) {
839 if (!prof->
sprofs) {
DIE0(
"error: realloc() failed!"); }
840 memset(&(prof->
sprofs[oldcount]), 0x00, sprofbufsz-(oldcount*
sizeof(PAPI_sprofil_t)));
845 MSGx(stderr,
"profile buffer details for %s:", prof->
ename);
846 MSGx(stderr,
" count = %d, sp=%"PRIu64
" ef=%d",
850 if (sharedprofdesc) {
854 for (mapi = oldcount; mapi < rtmap->
count; ++mapi) {
864 prof->
sprofs[mapi].pr_size = bufsz;
865 if (!prof->
sprofs[mapi].pr_base) {
866 DIE0(
"error: malloc() failed!");
868 memset(prof->
sprofs[mapi].pr_base, 0x00, bufsz);
876 MSGx(stderr,
"\tprofile[%d] base = %p size = %#"PRIxPTR
" off = %#"PRIxPTR
" scale = %#lx",
877 mapi, prof->
sprofs[mapi].pr_base, prof->
sprofs[mapi].pr_size,
878 prof->
sprofs[mapi].pr_off, prof->
sprofs[mapi].pr_scale);
892 for (i = 0; i < numEv; ++i) {
894 uint sprofbufsz =
sizeof(PAPI_sprofil_t) * rtmap->
count;
897 if (sharedprofdesc) {
902 prof->sprofs = (PAPI_sprofil_t*)
malloc(sprofbufsz);
903 if (!prof->sprofs) {
DIE0(
"error: malloc() failed!"); }
904 memset(prof->sprofs, 0x00, sprofbufsz);
905 prof->numsprofs = rtmap->
count;
910 MSGx(stderr,
"profile buffer details for %s:", prof->einfo.symbol);
911 MSGx(stderr,
" count = %d, es=%#x ec=%#x sp=%"PRIu64
" ef=%d",
912 prof->numsprofs, profdesc->
eset,
913 prof->ecode, prof->period, prof->flags);
916 if (sharedprofdesc) {
920 for (mapi = 0; mapi < rtmap->
count; ++mapi) {
925 ncntr = (rtmap->
module[mapi].
length / prof->bytesPerCodeBlk) + 1;
926 bufsz = ncntr * prof->bytesPerCntr;
929 prof->sprofs[mapi].pr_base = (
void*)
malloc(bufsz);
930 prof->sprofs[mapi].pr_size = bufsz;
931 if (!prof->sprofs[mapi].pr_base) {
932 DIE0(
"error: malloc() failed!");
934 memset(prof->sprofs[mapi].pr_base, 0x00, bufsz);
937 prof->sprofs[mapi].pr_off =
939 prof->sprofs[mapi].pr_scale = prof->scale;
943 "\tprofile[%d] base = %p size = %#x off = %p scale = %#x",
944 mapi, prof->sprofs[mapi].pr_base, prof->sprofs[mapi].pr_size,
945 prof->sprofs[mapi].pr_off, prof->sprofs[mapi].pr_scale);
959 for (i = 0; i < numEv; ++i) {
961 uint sprofbufsz =
sizeof(PAPI_sprofil_t) * rtmap->
count;
965 if (!sharedprofdesc) {
966 prof->sprofs = (PAPI_sprofil_t*)
realloc(prof->sprofs, sprofbufsz);
967 if (!prof->sprofs) {
DIE0(
"error: realloc() failed!"); }
968 memset(&(prof->sprofs[oldcount]), 0x00, sprofbufsz-(oldcount*
sizeof(PAPI_sprofil_t)));
969 prof->numsprofs = rtmap->
count;
973 MSGx(stderr,
"profile buffer details for %s:", prof->einfo.symbol);
974 MSGx(stderr,
" count = %d, es=%#x ec=%#x sp=%"PRIu64
" ef=%d",
975 prof->numsprofs, profdesc->
eset,
976 prof->ecode, prof->period, prof->flags);
979 if (sharedprofdesc) {
983 for (mapi = oldcount; mapi < rtmap->
count; ++mapi) {
988 ncntr = (rtmap->
module[mapi].
length / prof->bytesPerCodeBlk) + 1;
989 bufsz = ncntr * prof->bytesPerCntr;
992 prof->sprofs[mapi].pr_base = (
void*)
malloc(bufsz);
993 prof->sprofs[mapi].pr_size = bufsz;
994 if (!prof->sprofs[mapi].pr_base) {
995 DIE0(
"error: malloc() failed!");
997 memset(prof->sprofs[mapi].pr_base, 0x00, bufsz);
1000 prof->sprofs[mapi].pr_off =
1002 prof->sprofs[mapi].pr_scale = prof->scale;
1006 "\tprofile[%d] base = %p size = %#x off = %p scale = %#x",
1007 mapi, prof->sprofs[mapi].pr_base, prof->sprofs[mapi].pr_size,
1008 prof->sprofs[mapi].pr_off, prof->sprofs[mapi].pr_scale);
1023 char tmp_path[PATH_MAX];
1024 strcpy(tmp_path, path);
1025 int rc = stat(tmp_path, &buf);
1026 if ((rc<0) && (errno==ENOENT))
return 0;
1030 strcpy(tmp_path, path);
1031 sprintf(tmp_path,
"%s.%d", path, inst);
1032 rc = stat(tmp_path, &buf);
1033 }
while (!((rc<0) && (errno==ENOENT)));
1044 static uint outfilenmLen = PATH_MAX;
1045 static uint hostnmLen = 128;
1046 char outfilenm[outfilenmLen];
1047 char hostnm[hostnmLen];
1054 if (sharedprofdesc) {
1065 slash = rindex(cmd,
'/');
1083 gethostname(hostnm, hostnmLen);
1084 hostnm[hostnmLen-1] =
'\0';
1087 snprintf(outfilenm, outfilenmLen,
"%s/%s%s."HPCRUN_NAME".%s.%d.0x%lx",
1096 snprintf(outfilenm, outfilenmLen,
"%s.%d",
opt_file, inst);
1099 strncpy(outfilenm,
opt_file, outfilenmLen);
1105 snprintf(
opt_file, outfilenmLen,
"%s.%d", outfilenm, inst);
1106 strncpy(outfilenm,
opt_file, outfilenmLen);
1118 if (
opt_debug >= 1 && (errno == ENFILE || errno == EMFILE)) {
1119 MSG0(stderr,
"* waiting for file descriptors to test filesystem!");
1122 fs = fopen(outfilenm,
"w");
1124 while (errno == ENFILE || errno == EMFILE );
1127 DIEx(
"error: Filesystem test failed (cannot open file '%s'): %s",
1128 outfilenm, strerror(errno));
1139 const char* out_fname = profdesc->
ofile.
fname;
1140 const char* out_sfx =
"";
1143 out_sfx =
" (SHARED)";
1145 MSGx(stderr,
"Using output file %s%s\n", out_fname, out_sfx);
1152 int profidx,
char* eventnm, uint64_t
period)
1173 if (profidx >= profdescs->
size) {
1175 DIE0(
"error: Only one wallclock event may be profiled at a time.");
1178 prof = &(profdescs->
vec[profidx]);
1188 prof->
flags = PROF_FAST;
1192 DIEx(
"error: Invalid event: '%s'.", eventnm);
1197 DIEx(
"error: Invalid period %"PRIu64
" for event '%s'.",
1202 prof->
flags |= PROF_UINT;
1206 prof->
scale = 0x10000;
1209 DIE0(
"error: internal programming error - invalid profiling scale.");
1226 DIEx(
"error: sprofil() error. %s.", strerror(errno));
1244 MSG0(stderr,
"setting PAPI debug!");
1245 rval = PAPI_set_debug(PAPI_VERB_ECONT);
1246 if (rval != PAPI_OK) {
1247 DIEx(
"error: PAPI_set_debug (%d): %s.", rval, PAPI_strerror(rval));
1256 MSGx(stderr,
"Setting PAPI domain to: %d",
domain);
1258 rval = PAPI_set_domain(
domain);
1259 if (rval != PAPI_OK) {
1260 DIEx(
"error: PAPI_set_domain (%d): %s.", rval, PAPI_strerror(rval));
1264 #ifndef HAVE_MONITOR 1272 int profidx,
char* eventnm, uint64_t
period)
1323 DIE0(
"error: internal programming error.");
1326 if (profidx >= profdescs->
size) {
1327 MSGx(stderr,
"warning: Ignoring event '%s:%"PRIu64
"'.", eventnm, period);
1331 prof = &(profdescs->
vec[profidx]);
1336 rval = PAPI_event_name_to_code(eventnm, &prof->
ecode);
1337 if (rval != PAPI_OK) {
1338 DIEx(
"error: Event '%s' is not recognized.\n" 1339 "\tCheck the list of supported events with `"HPCRUN_NAME" -L'.",
1342 rval = PAPI_query_event(prof->
ecode);
1343 if (rval != PAPI_OK) {
1344 DIEx(
"error: Event '%s' is not supported on this platform.\n" 1345 "\tCheck the list of supported events with `"HPCRUN_NAME" -L'.",
1348 rval = PAPI_get_event_info(prof->
ecode, &prof->
einfo);
1349 if (rval != PAPI_OK) {
1350 DIEx(
"error: PAPI_get_event_info (%d): %s.", rval, PAPI_strerror(rval));
1354 if ((prof->
ecode & PAPI_PRESET_MASK) && (prof->
einfo.count > 1) &&
1355 strcmp(prof->
einfo.derived,
"DERIVED_CMPD") != 0) {
1356 DIEx(
"error: '%s' is a PAPI derived event.\n" 1357 "\tSampling of derived events is not supported by PAPI.\n" 1358 "\tUse `"HPCRUN_NAME" -L' to find the component native events of '%s' that you can monitor separately.", eventnm, eventnm);
1361 rval = PAPI_add_event(profdescs->
eset, prof->
ecode);
1362 if (rval != PAPI_OK) {
1363 DIEx(
"error: (%d) Unable to add event '%s' to event set.\n" 1364 "\tPAPI_add_event %s.", rval, eventnm, PAPI_strerror(rval));
1369 DIEx(
"error: Invalid period %"PRIu64
" for event '%s'.",
1376 prof->
flags |= PAPI_PROFIL_BUCKET_32;
1380 prof->
scale = 0x8000;
1383 DIE0(
"error: internal programming error - invalid profiling scale.");
1394 if (!profdescs) {
return; }
1403 for (i = 0; i < profdescs->
size; ++i) {
1407 MSGx(stderr,
"Calling PAPI_sprofil(): %s", prof->
einfo.symbol);
1412 if (rval != PAPI_OK) {
1413 DIEx(
"error: PAPI_sprofil (%d): %s.", rval, PAPI_strerror(rval));
1418 rval = PAPI_start(profdescs->
eset);
1419 if (rval != PAPI_OK) {
1420 DIEx(
"error: PAPI_start (%d): %s.", rval, PAPI_strerror(rval));
1438 if (signal(sig, SIG_IGN) != SIG_IGN) {
1442 MSGx(stderr,
"warning: Signal %d already has a handler.", sig);
1458 int sharedprofdesc);
1468 static int is_finalized = 0;
1471 if (
opt_debug >= 1) {
MSG0(stderr,
"*** fini_process (skip) ***"); }
1476 if (
opt_debug >= 1) {
MSG0(stderr,
"*** fini_process ***"); }
1493 int sharedprofdesc = 0;
1495 if (
opt_debug >= 1) {
MSG0(stderr,
"*** fini_thread ***"); }
1514 #if (!OPEN_OUTPUTFILE_AT_BEG) 1515 MSG0(stderr,
"*** TST ***\n");
1537 if ((ecode = sprofil(
NULL, 0,
NULL, 0)) != 0) {
1539 DIEx(
"error: sprofil() error. %s.", strerror(errno));
1549 long_long* values =
NULL;
1551 rval = PAPI_stop(profdescs->
eset, values);
1552 if (rval != PAPI_OK) {
1557 for (i = 0; i < profdescs->
size; ++i) {
1562 if (rval != PAPI_OK) {
1574 rval = PAPI_cleanup_eventset(profdescs->
eset);
1575 if (rval != PAPI_OK) {
1576 MSGx(stderr,
"warning: PAPI_cleanup_eventset (%d): %s.", rval, PAPI_strerror(rval));
1579 rval = PAPI_destroy_eventset(&profdescs->
eset);
1580 if (rval != PAPI_OK) {
1581 MSGx(stderr,
"warning: PAPI_destroy_eventset (%d): %s.", rval, PAPI_strerror(rval));
1583 profdescs->
eset = PAPI_NULL;
1587 rval = PAPI_unregister_thread();
1588 if (rval != PAPI_OK) {
1589 MSGx(stderr,
"warning: PAPI_unregister_thread (%d): %s.", rval, PAPI_strerror(rval));
1605 uint numSysEv = 0, numPapiEv = 0;
1607 if (!profdesc || !*profdesc) {
return; }
1617 for (i = 0; i < numSysEv; ++i) {
1619 if (!sharedprofdesc) {
1634 for (i = 0; i < numPapiEv; ++i) {
1636 if (!sharedprofdesc) {
1645 if (numPapiEv > 0) {
1651 free((*profdesc)->ofile.fname);
1652 (*profdesc)->ofile.fname =
NULL;
1675 uint64_t ncounters,
uint bytesPerCodeBlk);
1689 if (
opt_debug >= 1) {
MSG0(stderr,
"*** write_all_profiles: begin ***"); }
1697 if (
opt_debug >= 1 && (errno == ENFILE || errno == EMFILE)) {
1698 MSG0(stderr,
"* waiting for file descriptors to write data!");
1703 while (errno == ENFILE || errno == EMFILE );
1706 DIEx(
"error: Could not open file '%s': %s", profdesc->
ofile.
fname,
1719 for (i = 0; i < rtmap->
count; ++i) {
1725 if (
opt_debug >= 1) {
MSG0(stderr,
"*** write_all_profiles: end ***"); }
1735 uint numSysEv = 0, numPapiEv = 0;
1738 MSGx(stderr,
"writing module %s (at offset %#"PRIx64
")",
1760 for (i = 0; i < numSysEv; ++i) {
1765 for (i = 0; i < numPapiEv; ++i) {
1787 char* ename = prof->
ename;
1788 struct prof* sprof = &(prof->
sprofs[sprofidx]);
1790 uint64_t ncounters = (sprof->pr_size / prof->
bytesPerCntr);
1799 char* ename = prof->
einfo.symbol;
1800 PAPI_sprofil_t* sprof = &(prof->
sprofs[sprofidx]);
1802 uint64_t ncounters = (sprof->pr_size / prof->
bytesPerCntr);
1805 MSGx(stderr,
" writing %p[%d] = %p for %s with buf (%p):",
1806 prof, sprofidx, sprof, ename, histo);
1815 uint64_t ncounters,
uint bytesPerCodeBlk)
1817 uint64_t count = 0, offset = 0, i = 0, inz = 0;
1821 for (i = 0; i < ncounters; ++i) {
1822 if (histo[i] != 0) { count++; inz = i; }
1827 MSGx(stderr,
" buffer (%p) for %s has %"PRIu64
" of %"PRIu64
" non-zero counters (last non-zero counter: %"PRIu64
")",
1828 histo, ename, count, ncounters, inz);
1833 for (i = 0; i < ncounters; ++i) {
1834 if (histo[i] != 0) {
1835 uint32_t
cnt = histo[i];
1838 offset = i * bytesPerCodeBlk;
1842 MSGx(stderr,
" (cnt,offset)=(%d,%"PRIx64
")", cnt, offset);
1853 uint len = strlen(str);
1867 return (
long)(monitor_gettid());
1875 const char* arg, va_list arglist)
1881 int argvSz = 32, argc = 1;
1883 *argv =
malloc((argvSz+1) *
sizeof(
const char*));
1884 if (!*argv) {
DIE0(
"error: malloc() failed!"); }
1887 while ((argp = va_arg(arglist,
const char*)) !=
NULL) {
1888 if (argc > argvSz) {
1890 *argv =
realloc(*argv, (argvSz+1) *
sizeof(
const char*));
1891 if (!*argv) {
DIE0(
"error: realloc() failed!"); }
1893 (*argv)[argc] = argp;
1896 (*argv)[argc] =
NULL;
1899 *envp = va_arg(arglist,
const char*
const*);
1905 for (i = 0; i < argc; ++i) {
1906 MSGx(stderr,
" execl arg%d: %s", i, (*argv)[i]);
1909 MSG0(stderr,
" execl envp found");
static rtloadmap_t * rtloadmap
static void init_sysprofdesc_buffer(hpcsys_profile_desc_vec_t *profdesc, uint numEv, rtloadmap_t *rtmap, hpcsys_profile_desc_vec_t *sharedprofdesc)
unsigned int bytesPerCntr
#define HPCRUN_EVENT_WALLCLK_STR
#define HPC_GET_PAPIPROFS(x)
static void init_sighandler(int sig)
size_t hpcio_le4_fwrite(uint32_t *val, FILE *fs)
static void write_event_data(FILE *fs, char *ename, hpc_hist_bucket *histo, uint64_t ncounters, uint bytesPerCodeBlk)
void init_papi_for_process_SPECIALIZED()
static void stop_sysprof(hpcsys_profile_desc_vec_t *profdescs)
void MONITOR_EXT_WRAP_NAME() free(void *ptr)
unsigned int bytesPerCodeBlk
#define HPCRUN_EVENT_WALLCLK_STRLN
static void write_all_profiles(hpcrun_profiles_desc_t *profdesc, rtloadmap_t *rtmap)
static void write_string(FILE *fp, char *str)
const hpcpapi_flagdesc_t * hpcpapi_flag_by_name(const char *name)
static int get_next_gen(const char *path)
static void count_events(uint *sysEvents, uint *papiEvents)
static const uint64_t default_period
#define HPC_GET_SYSPROFS(x)
static void hpcrun_sighandler(int sig)
void dump_hpcpapi_profile_desc_vec(hpcpapi_profile_desc_vec_t *descvec)
static void init_papi_for_process()
static void append_papiprofdesc_buffer(hpcpapi_profile_desc_vec_t *profdesc, uint numEv, rtloadmap_t *rtmap, hpcpapi_profile_desc_vec_t *sharedprofdesc)
void init_library_SPECIALIZED()
#define HPCRUNFLAT_FMT_Endian
void fini_thread(hpcrun_profiles_desc_t **profdesc, int is_thread)
static void init_papiprofdesc_buffer(hpcpapi_profile_desc_vec_t *profdesc, uint numEv, rtloadmap_t *rtmap, hpcpapi_profile_desc_vec_t *sharedprofdesc)
static void init_profdesc(hpcrun_profiles_desc_t **profdesc, uint numSysEv, uint numPapiEv, rtloadmap_t *rtmap, hpcrun_profiles_desc_t *sharedprofdesc)
static uint numPAPIEvents
rtloadmap_t * hpcrun_get_rtloadmap(int dbglvl)
static void add_sysevent(hpcsys_profile_desc_vec_t *profdescs, rtloadmap_t *rtmap, int profidx, char *eventnm, uint64_t period)
static void fini_papi_for_thread(hpcpapi_profile_desc_vec_t *profdescs)
unsigned int bytesPerCntr
long hpcrun_gettid_SPECIALIZED()
#define HPCRUNFLAT_FMT_Magic
static void write_sysevent_data(FILE *fs, hpcsys_profile_desc_t *prof, int sprofidx)
enum enum_hpc_threadprof_t hpc_threadprof_t
static hpcrun_profiles_desc_t * hpc_profdesc
static void init_options()
#define HPCRUN_EVENT_FWALLCLK_STRLN
static void init_profdesc_ofile(hpcrun_profiles_desc_t *profdesc, int sharedprofdesc)
static void write_module_profile(FILE *fp, rtloadmod_desc_t *mod, hpcrun_profiles_desc_t *profdesc, int sprofidx)
int hpc_init_papi_force(int(*init)(int))
static BAnal::Struct::Options opts
static void notify_ofile(hpcrun_profiles_desc_t *profdesc, hpcrun_profiles_desc_t *sharedprofdesc)
rtloadmod_desc_t * module
static void fini_papi_for_process()
volatile int DEBUGGER_WAIT
static void start_sysprof(hpcsys_profile_desc_vec_t *profdescs)
static void fini_profdesc(hpcrun_profiles_desc_t **profdesc, int sharedprofdesc)
#define HPC_GETL_SYSPROFS(x)
void *MONITOR_EXT_WRAP_NAME() realloc(void *ptr, size_t bytes)
char opt_outpath[PATH_MAX]
int mkdir(const char *dir)
hpcpapi_profile_desc_t * vec
#define HPC_GETL_PAPIPROFS(x)
unsigned int bytesPerCodeBlk
hpcrun_ofile_desc_t ofile
hpcrun_profiles_desc_t * init_thread(int is_thread)
void *MONITOR_EXT_WRAP_NAME() malloc(size_t bytes)
static void start_papi_for_thread(hpcpapi_profile_desc_vec_t *profdescs)
size_t hpcio_le8_fwrite(uint64_t *val, FILE *fs)
#define HPCRUNFLAT_FMT_MagicLen
size_t MONITOR_EXT_WRAP_NAME() fwrite(const void *ptr, size_t size, size_t count, FILE *stream)
#define HPCRUNFLAT_Version
hpc_threadprof_t opt_thread
void hpcrun_parse_execl(const char ***argv, const char *const **envp, const char *arg, va_list arglist)
static void append_sysprofdesc_buffer(hpcsys_profile_desc_vec_t *profdesc, uint numEv, rtloadmap_t *rtmap, hpcsys_profile_desc_vec_t *sharedprofdesc)
static void stop_papi_for_thread(hpcpapi_profile_desc_vec_t *profdescs)
#define HPCRUN_EVENT_FWALLCLK_STR
static void init_option_debug()
char opt_prefix[PATH_MAX]
static void write_papievent_data(FILE *fp, hpcpapi_profile_desc_t *prof, int sprofidx)
static void add_papievent(hpcpapi_profile_desc_vec_t *profdescs, rtloadmap_t *rtmap, int profidx, char *eventnm, uint64_t period)
hpcsys_profile_desc_t * vec
#define HPCRUNFLAT_VersionLen
static void init_sighandlers()
static void write_event_hdr(FILE *fs, char *name, char *desc, uint64_t period)