25#if defined(__INTEL_COMPILER)
27#define hweight64(x) _m64_popcnt(x)
29#elif defined(__GNUC__)
32hweight64(
unsigned long x )
35 __asm__(
"popcnt %0=%1":
"=r"(
result ):
"r"(
x ) );
40#error "you need to provide inline assembly from your compiler"
46#define OVFL_SIGNAL SIGPROF
47#define PFMW_PEVT_EVTCOUNT(evt) (evt->inp.pfp_event_count)
48#define PFMW_PEVT_EVENT(evt,idx) (evt->inp.pfp_events[idx].event)
49#define PFMW_PEVT_PLM(evt,idx) (evt->inp.pfp_events[idx].plm)
50#define PFMW_PEVT_DFLPLM(evt) (evt->inp.pfp_dfl_plm)
51#define PFMW_PEVT_PFPPC(evt) (evt->pc)
52#define PFMW_PEVT_PFPPD(evt) (evt->pd)
53#define PFMW_PEVT_PFPPC_COUNT(evt) (evt->outp.pfp_pmc_count)
54#define PFMW_PEVT_PFPPC_REG_NUM(evt,idx) (evt->outp.pfp_pmcs[idx].reg_num)
55#define PFMW_PEVT_PFPPC_REG_VAL(evt,idx) (evt->pc[idx].reg_value)
56#define PFMW_PEVT_PFPPC_REG_FLG(evt,idx) (evt->pc[idx].reg_flags)
57#define PFMW_ARCH_REG_PMCVAL(reg) (reg.pmc_val)
58#define PFMW_ARCH_REG_PMDVAL(reg) (reg.pmd_val)
60#define PFMON_MONT_MAX_IBRS 8
61#define PFMON_MONT_MAX_DBRS 8
63#define PFMON_ITA2_MAX_IBRS 8
64#define PFMON_ITA2_MAX_DBRS 8
124#ifdef PFMLIB_MONTECITO_PMU
147#if defined(HAVE_PFMLIB_OUTPUT_PFP_PMD_COUNT)
167 memset( &load_args, 0,
sizeof ( load_args ) );
174 SUBDBG(
"PFM_LOAD_CONTEXT FD %d, PID %d\n",
191 PAPIERROR(
"fcntl(%d,F_SETFL,O_ASYNC) errno %d",
204 PAPIERROR(
"fcntl(%d,F_SETOWN) errno %d",
213 PAPIERROR(
"fcntl(%d,F_SETSIG) errno %d",
221 ret = fcntl( ( (
ia64_context_t * ) ctx )->fd, F_SETFD, FD_CLOEXEC );
223 PAPIERROR(
"fcntl(%d,FD_CLOEXEC) errno %d",
236 memset( &ctx, 0,
sizeof ( ctx ) );
238 SUBDBG(
"PFM_CREATE_CONTEXT on 0\n" );
245 SUBDBG(
"PFM_CREATE_CONTEXT returns FD %d, TID %d\n",
278 unsigned int *umask );
282 void **smpl_vaddr,
int EventIndex )
287 unsigned int native_index, EventCode;
290#ifdef PFMLIB_MONTECITO_PMU
296#ifdef PFMLIB_MONTECITO_PMU
307 memset( &ctx, 0,
sizeof ( ctx ) );
323 SUBDBG(
"PFM_CREATE_CONTEXT on 0\n" );
325 if (
errno == ENOSYS )
327 (
"Your kernel does not have performance monitoring support" );
340 SUBDBG(
"PFM_CREATE_CONTEXT returns FD %d, TID %d\n",
368 PAPIERROR(
"PMU type %d is not supported by this component",
398 strncpy( dest,
descr, len );
418 PAPIERROR(
"PMU type %d is not supported by this component",
438 PAPIERROR(
"PMU type %d is not supported by this component",
458 PAPIERROR(
"PMU type %d is not supported by this component",
478 PAPIERROR(
"PMU type %d is not supported by this component",
498 PAPIERROR(
"PMU type %d is not supported by this component",
509 unsigned long umasks_retired[4];
511 unsigned int j,
i, seen_retired, ibrp, idx;
513 int retired_code, incr;
517#if defined(PFMLIB_ITANIUM2_PMU) || defined(PFMLIB_MONTECITO_PMU)
518char *retired_events[] = {
519 "IA64_TAGGED_INST_RETIRED_IBRP0_PMC8",
520 "IA64_TAGGED_INST_RETIRED_IBRP1_PMC9",
521 "IA64_TAGGED_INST_RETIRED_IBRP2_PMC8",
522 "IA64_TAGGED_INST_RETIRED_IBRP3_PMC9",
539 for (
i = 0; retired_events[
i];
i++ ) {
559 if ( code != retired_code )
564 if ( umask == umasks_retired[ibrp] )
569 (
"warning: code range uses IBR pair %d which is not monitored using %s\n",
570 ibrp, retired_events[ibrp] );
585 for (
i = 0; retired_events[
i];
i++ ) {
605 if ( code != retired_code )
610 if ( umask == umasks_retired[ibrp] )
615 (
"warning: code range uses IBR pair %d which is not monitored using %s\n",
616 ibrp, retired_events[ibrp] );
620 PAPIERROR(
"PMU type %d is not supported by this component",
629 unsigned int i, used_dbr;
638 memset( mont_dbreg, 0,
sizeof ( mont_dbreg ) );
639 memset( ita2_dbreg, 0,
sizeof ( ita2_dbreg ) );
648 for (
i = 0;
i < used_dbr;
i++ ) {
658 SUBDBG(
"cannot install code range restriction: %s\n",
670 for (
i = 0;
i < used_dbr;
i++ ) {
680 SUBDBG(
"cannot install code range restriction: %s\n",
687 PAPIERROR(
"PMU type %d is not supported by this component",
697 unsigned int i, used_dbr;
706 memset( mont_dbreg, 0,
sizeof ( mont_dbreg ) );
707 memset( ita2_dbreg, 0,
sizeof ( ita2_dbreg ) );
715 for (
i = 0;
i < used_dbr;
i++ ) {
725 SUBDBG(
"cannot install data range restriction: %s\n",
736 for (
i = 0;
i < used_dbr;
i++ ) {
746 SUBDBG(
"cannot install data range restriction: %s\n",
753 PAPIERROR(
"PMU type %d is not supported by this component",
805 (
"++++ before data range : [%#016lx-%#016lx=%ld]: %d pair of debug registers used\n"
806 " start_offset:-%#lx end_offset:+%#lx\n",
823 (
"++++ data range : [%#016lx-%#016lx=%ld]: %d pair of debug registers used\n"
824 " start_offset:-%#lx end_offset:+%#lx\n",
869 (
"++++ before data range : [%#016lx-%#016lx=%ld]: %d pair of debug registers used\n"
870 " start_offset:-%#lx end_offset:+%#lx\n",
886 (
"++++ data range : [%#016lx-%#016lx=%ld]: %d pair of debug registers used\n"
887 " start_offset:-%#lx end_offset:+%#lx\n",
912 PAPIERROR(
"PMU type %d is not supported by this component",
957 (
"++++ before code range : [%#016lx-%#016lx=%ld]: %d pair of debug registers used\n"
958 " start_offset:-%#lx end_offset:+%#lx\n",
975 (
"++++ code range : [%#016lx-%#016lx=%ld]: %d pair of debug registers used\n"
976 " start_offset:-%#lx end_offset:+%#lx\n",
1013 (
"++++ before code range : [%#016lx-%#016lx=%ld]: %d pair of debug registers used\n"
1014 " start_offset:-%#lx end_offset:+%#lx\n",
1031 (
"++++ code range : [%#016lx-%#016lx=%ld]: %d pair of debug registers used\n"
1032 " start_offset:-%#lx end_offset:+%#lx\n",
1049 PAPIERROR(
"PMU type %d is not supported by this component",
1123 {
"L1D_READ_MISSES_RETIRED",
"L2_INST_DEMAND_READS"}, {0}},
1125 {
PAPI_L1_DCM, 0, {
"L1D_READ_MISSES_RETIRED"}, {0}},
1128 {
PAPI_L2_ICM, 0, {
"L3_READS_INST_READS_ALL"}, {0}},
1130 {
PAPI_L3_ICM, 0, {
"L3_READS_INST_READS_MISS"}, {0}},
1132 {
"L3_READS_DATA_READS_MISS",
"L3_WRITES_DATA_WRITES_MISS"}, {0}},
1133 {
PAPI_L3_LDM, 0, {
"L3_READS_DATA_READS_MISS"}, {0}},
1134 {
PAPI_L3_STM, 0, {
"L3_WRITES_DATA_WRITES_MISS"}, {0}},
1135 {
PAPI_L1_LDM, 0, {
"L1D_READ_MISSES_RETIRED"}, {0}},
1136 {
PAPI_L2_LDM, 0, {
"L3_READS_DATA_READS_ALL"}, {0}},
1137 {
PAPI_L2_STM, 0, {
"L3_WRITES_ALL_WRITES_ALL"}, {0}},
1139 {
"L3_READS_DATA_READS_HIT",
"L3_WRITES_DATA_WRITES_HIT"}, {0}},
1143 {
PAPI_L2_DCA, 0, {
"L2_DATA_REFERENCES_ALL"}, {0}},
1145 {
"L3_READS_DATA_READS_ALL",
"L3_WRITES_DATA_WRITES_ALL"}, {0}},
1146 {
PAPI_L2_DCR, 0, {
"L2_DATA_REFERENCES_READS"}, {0}},
1147 {
PAPI_L3_DCR, 0, {
"L3_READS_DATA_READS_ALL"}, {0}},
1148 {
PAPI_L2_DCW, 0, {
"L2_DATA_REFERENCES_WRITES"}, {0}},
1149 {
PAPI_L3_DCW, 0, {
"L3_WRITES_DATA_WRITES_ALL"}, {0}},
1150 {
PAPI_L3_ICH, 0, {
"L3_READS_INST_READS_HIT"}, {0}},
1153 {
"L2_INST_DEMAND_READS",
"L2_INST_PREFETCH_READS"}, {0}},
1154 {
PAPI_L3_ICR, 0, {
"L3_READS_INST_READS_ALL"}, {0}},
1160 {
PAPI_BR_PRC, 0, {
"BRANCH_PREDICTOR_ALL_CORRECT_PREDICTIONS"}, {0}},
1162 {
"BRANCH_PREDICTOR_ALL_WRONG_PATH",
"BRANCH_PREDICTOR_ALL_WRONG_TARGET"},
1176 {
"BUS_MEM_READ_BRIL_SELF",
"BUS_MEM_READ_BIL_SELF"}, {0}},
1185 {
"L2_DATA_REFERENCES_L2_DATA_READS",
"L2_INST_DEMAND_READS",
1186 "L2_INST_PREFETCHES"}, {0}},
1193 {
PAPI_L2_ICM, 0, {
"L3_READS_INST_FETCH_ALL"}, {0}},
1195 {
PAPI_L3_ICM, 0, {
"L3_READS_INST_FETCH_MISS"}, {0}},
1197 {
"L3_READS_DATA_READ_MISS",
"L3_WRITES_DATA_WRITE_MISS"}, {0}},
1199 {
PAPI_L3_STM, 0, {
"L3_WRITES_DATA_WRITE_MISS"}, {0}},
1207 {
"L3_READS_DATA_READ_HIT",
"L3_WRITES_DATA_WRITE_HIT"}, {0}},
1209 {
PAPI_L2_DCA, 0, {
"L2_DATA_REFERENCES_L2_ALL"}, {0}},
1211 {
"L3_READS_DATA_READ_ALL",
"L3_WRITES_DATA_WRITE_ALL"}, {0}},
1213 {
PAPI_L2_DCR, 0, {
"L2_DATA_REFERENCES_L2_DATA_READS"}, {0}},
1214 {
PAPI_L3_DCR, 0, {
"L3_READS_DATA_READ_ALL"}, {0}},
1215 {
PAPI_L2_DCW, 0, {
"L2_DATA_REFERENCES_L2_DATA_WRITES"}, {0}},
1216 {
PAPI_L3_DCW, 0, {
"L3_WRITES_DATA_WRITE_ALL"}, {0}},
1217 {
PAPI_L3_ICH, 0, {
"L3_READS_DINST_FETCH_HIT"}, {0}},
1221 {
PAPI_L3_ICR, 0, {
"L3_READS_INST_FETCH_ALL"}, {0}},
1230 {
PAPI_TLB_IM, 0, {
"ITLB_MISSES_FETCH_L2ITLB"}, {0}},
1232 {
PAPI_BR_PRC, 0, {
"BR_MISPRED_DETAIL_ALL_CORRECT_PRED"}, {0}},
1234 {
"BR_MISPRED_DETAIL_ALL_WRONG_PATH",
"BR_MISPRED_DETAIL_ALL_WRONG_TARGET"},
1243 {
PAPI_L3_ICA, 0, {
"L3_READS_INST_FETCH_ALL"}, {0}},
1246 {
PAPI_L2_TCW, 0, {
"L2_DATA_REFERENCES_L2_DATA_WRITES"}, {0}},
1252 {
PAPI_CA_SNP, 0, {
"BUS_SNOOP_STALL_CYCLES_ANY"}, {0}},
1254 {
"BUS_MEM_READ_BRIL_SELF",
"BUS_MEM_READ_BIL_SELF"}, {0}},
1265 {
"L2D_REFERENCES_READS",
"L2I_READS_ALL_DMND",
"L2I_READS_ALL_PFTCH"},
1275 {
PAPI_L2_TCM, 0, {
"L2I_READS_MISS_ALL",
"L2D_MISSES"}, {0}},
1279 {
PAPI_L3_ICM, 0, {
"L3_READS_INST_FETCH_MISS:M:E:S:I"}, {0}},
1281 {
"L3_READS_DATA_READ_MISS:M:E:S:I",
"L3_WRITES_DATA_WRITE_MISS:M:E:S:I"},
1283 {
PAPI_L3_LDM, 0, {
"L3_READS_ALL_MISS:M:E:S:I"}, {0}},
1284 {
PAPI_L3_STM, 0, {
"L3_WRITES_DATA_WRITE_MISS:M:E:S:I"}, {0}},
1289 {
PAPI_L2_LDM, 0, {
"L3_READS_ALL_ALL:M:E:S:I"}, {0}},
1290 {
PAPI_L2_STM, 0, {
"L3_WRITES_ALL_ALL:M:E:S:I"}, {0}},
1294 {
"L3_READS_DATA_READ_HIT:M:E:S:I",
"L3_WRITES_DATA_WRITE_HIT:M:E:S:I"},
1301 {
PAPI_L3_DCR, 0, {
"L3_READS_DATA_READ_ALL:M:E:S:I"}, {0}},
1303 {
PAPI_L3_DCW, 0, {
"L3_WRITES_DATA_WRITE_ALL:M:E:S:I"}, {0}},
1304 {
PAPI_L3_ICH, 0, {
"L3_READS_DINST_FETCH_HIT:M:E:S:I"}, {0}},
1307 {
PAPI_L3_ICR, 0, {
"L3_READS_INST_FETCH_ALL:M:E:S:I"}, {0}},
1314 {
PAPI_L3_TCR, 0, {
"L3_READS_ALL_ALL:M:E:S:I"}, {0}},
1315 {
PAPI_L3_TCW, 0, {
"L3_WRITES_ALL_ALL:M:E:S:I"}, {0}},
1317 {
PAPI_TLB_IM, 0, {
"ITLB_MISSES_FETCH_L2ITLB"}, {0}},
1319 {
PAPI_BR_PRC, 0, {
"BR_MISPRED_DETAIL_ALL_CORRECT_PRED"}, {0}},
1321 {
"BR_MISPRED_DETAIL_ALL_WRONG_PATH",
"BR_MISPRED_DETAIL_ALL_WRONG_TARGET"},
1330 {
PAPI_L3_ICA, 0, {
"L3_READS_INST_FETCH_ALL:M:E:S:I"}, {0}},
1336 {
"L1I_PREFETCHES",
"L1I_READS",
"L1D_READS_SET0"}, {0}},
1353 unsigned int *umask )
1355 unsigned int tevent, major, minor;
1365 SUBDBG(
"EventCode %#08x is event %d, umask %#x\n", EventCode, major,
1377 SUBDBG(
"Old native index was %#08x with %#08x mask\n",
tmp, mask );
1387 unsigned int tmp = foo,
i, j = 0;
1392 while ( (
i = ffs(
tmp ) ) ) {
1393 tmp =
tmp ^ ( 1 << (
i - 1 ) );
1404 unsigned int event, umask, num_masks;
1416 SUBDBG(
"pfm_get_num_event_masks: event=%d num_masks=%d\n", event,
1419 PAPIERROR(
"pfm_get_num_event_masks(%d,%p): %s", event, &num_masks,
1425 SUBDBG(
"This is umask %d of %d\n", umask, num_masks );
1434 if ( umask + 1 < (
unsigned ) ( 1 << num_masks ) ) {
1440 int thisbit = ffs( umask );
1442 SUBDBG(
"First bit is %d in %08x\b\n", thisbit - 1, umask );
1443 thisbit = 1 << thisbit;
1445 if ( thisbit & ( ( 1 << num_masks ) - 1 ) ) {
1465 unsigned int i, mask = 0;
1468 SUBDBG(
"pfm_find_full_event(%s,%p)\n",
name, &event );
1478 for (
i = 0;
i <
event.num_masks;
i++ ) {
1480 SUBDBG(
"mask index (%d) > max masks (%d)\n",
1484 mask |= 1 <<
event.unit_masks[
i];
1487 SUBDBG(
"event_code: %#x event: %d num_masks: %d\n", *event_code,
1505 unsigned int event, umask;
1508 memset( &gete, 0,
sizeof ( gete ) );
1523 (
"pfm_get_full_event_name(%p(event %d,%s,%d masks),%p,%d): %d -- %s",
1536 unsigned int event, umask;
1537 char *eventd, **maskd, *
tmp;
1538 int i, ret, total_len = 0;
1541 memset( &gete, 0,
sizeof ( gete ) );
1548 PAPIERROR(
"pfm_get_event_description(%d,%p): %s",
1554 maskd = (
char ** ) malloc( gete.
num_masks * sizeof (
char * ) );
1555 if ( maskd == NULL ) {
1564 PAPIERROR(
"pfm_get_event_mask_description(%d,%d,%p): %s",
1567 for ( ;
i >= 0;
i-- )
1572 total_len += strlen( maskd[
i] );
1575 (
char * ) malloc( strlen( eventd ) + strlen(
", masks:" ) +
1577 if (
tmp == NULL ) {
1584 strcat(
tmp, eventd );
1585 strcat(
tmp,
", masks:" );
1589 strcat(
tmp, maskd[
i] );
1594 tmp = (
char * ) malloc( strlen( eventd ) + 1 );
1595 if (
tmp == NULL ) {
1600 strcat(
tmp, eventd );
1603 strncpy( ntv_descr,
tmp, len );
1604 if ( strlen(
tmp ) > (
unsigned int ) len - 1 )
1633 int pnum,
i = 0, cnt;
1644 if ( psmap == NULL )
1658 while ( *findme != NULL ) {
1660 PAPIERROR(
"Count (%d) == MAX_COUNTER_TERMS (%d)\n", cnt,
1668 (
unsigned int * ) &psmap[
i].data.
native[cnt] ) !=
1670 PAPIERROR(
"_papi_pfm_ntv_name_to_code(%s) failed\n",
1679 (
unsigned int * ) &psmap[
i].data.
native[cnt] ) !=
1681 PAPIERROR(
"pfm_find_event_byname(%s) failed\n", *findme );
1707 while ( fgets( line, 256,
f ) != NULL ) {
1708 if ( strstr( line, search_str ) != NULL ) {
1710 for (
s = line; *
s && ( *
s !=
':' ); ++
s );
1723 int mode = 0, did = 0,
i;
1747 SUBDBG(
"slot %d, register %lud active, config value %#lx\n",
1755 SUBDBG(
"new config value %#lx\n",
1766 int mode = 0, did = 0,
i;
1790 SUBDBG(
"slot %d, register %lud active, config value %#lx\n",
1798 SUBDBG(
"new config value %#lx\n",
1809 int mode = 0, did = 0,
i;
1833 SUBDBG(
"slot %d, register %lud active, config value %#lx\n",
1841 SUBDBG(
"new config value %#lx\n",
1863 PAPIERROR(
"PMU type %d is not supported by this component",
1872 ( void ) this_state;
1889 long long **
events,
int flags )
1896 memset( readem, 0x0,
sizeof readem );
1908 SUBDBG(
"perfmonctl error READ_PMDS errno %d\n",
errno );
1916 SUBDBG(
"read counters is %ld\n", readem[
i].reg_value );
1936 long long **
events,
int flags )
1943 memset( readem, 0x0,
sizeof readem );
1955 SUBDBG(
"perfmonctl error READ_PMDS errno %d\n",
errno );
1963 SUBDBG(
"read counters is %ld\n", readem[
i].reg_value );
1973 long long **
events,
int flags )
1986 PAPIERROR(
"PMU type %d is not supported by this component",
2039 PAPIERROR(
"Version mismatch of libpfm: compiled %#x vs. installed %#x",
2045 memset( &pfmlib_options, 0,
sizeof ( pfmlib_options ) );
2074 PAPIERROR(
"PMU type %d is not supported by this component",
type );
2131#if defined(USE_PROC_PTTIMER)
2135 sprintf(
buf,
"/proc/%d/task/%d/stat", getpid( ),
mygettid( ) );
2156 memset( writeem, 0,
sizeof writeem );
2161 writeem[
i].
reg_value = machdep->pd[
i].reg_long_reset;
2228 return ns + leftover_ns;
2304#if defined(USE_PROC_PTTIMER)
2305 close( ctx->stat_fd );
2317 unsigned long buf_pos;
2318 unsigned long entry_size;
2319 int ret, reg_num,
count, pos;
2320 unsigned int i, EventCode = 0, eventindex, native_index = 0;
2323 unsigned long overflow_vector, pc;
2337 buf_pos = (
unsigned long ) ( hdr + 1 );
2342 overflow_vector = 1 << ent->
ovfl_pmd;
2344 SUBDBG(
"Entry %d PID:%d CPU:%d ovfl_vector:%#lx IIP:%#016lx\n",
2345 i, ent->
pid, ent->
cpu, overflow_vector, ent->
ip );
2347 while ( overflow_vector ) {
2348 reg_num = ffs( overflow_vector ) - 1;
2364 (
"wrong count: %d vs. ESI->profile.event_counter %d\n",
2384 overflow_vector ^= (
unsigned long ) 1 << reg_num;
2387 buf_pos += entry_size;
2398 unsigned long buf_pos;
2399 unsigned long entry_size;
2400 int ret, reg_num,
count, pos;
2401 unsigned int i, EventCode = 0, eventindex, native_index = 0;
2404 unsigned long overflow_vector, pc;
2418 buf_pos = (
unsigned long ) ( hdr + 1 );
2423 overflow_vector = 1 << ent->
ovfl_pmd;
2425 SUBDBG(
"Entry %d PID:%d CPU:%d ovfl_vector:%#lx IIP:%#016lx\n",
2426 i, ent->
pid, ent->
cpu, overflow_vector, ent->
ip );
2428 while ( overflow_vector ) {
2429 reg_num = ffs( overflow_vector ) - 1;
2445 (
"wrong count: %d vs. ESI->profile.event_counter %d\n",
2466 overflow_vector ^= (
unsigned long ) 1 << reg_num;
2469 buf_pos += entry_size;
2480 unsigned long buf_pos;
2481 unsigned long entry_size;
2482 int ret, reg_num,
count, pos;
2483 unsigned int i, EventCode = 0, eventindex, native_index = 0;
2486 unsigned long overflow_vector, pc;
2501 buf_pos = (
unsigned long ) ( hdr + 1 );
2506 overflow_vector = 1 << ent->
ovfl_pmd;
2508 SUBDBG(
"Entry %d PID:%d CPU:%d ovfl_vector:%#lx IIP:%#016lx\n",
2509 i, ent->
pid, ent->
cpu, overflow_vector, ent->
ip );
2511 while ( overflow_vector ) {
2512 reg_num = ffs( overflow_vector ) - 1;
2529 (
"wrong count: %d vs. ESI->profile.event_counter %d\n",
2549 overflow_vector ^= (
unsigned long ) 1 << reg_num;
2552 buf_pos += entry_size;
2571 PAPIERROR(
"PMU type %d is not supported by this component",
2588 PAPIERROR(
"thread == NULL in _papi_hwd_dispatch_timer!" );
2602 if (
thread->running_eventset[
cidx]->overflow.
2613 ret =
read( fd, &msg,
sizeof ( msg ) );
2615 if (
errno == EINTR ) {
2616 SUBDBG(
"read(%d) interrupted, retrying\n", fd );
2621 }
else if ( ret !=
sizeof ( msg ) ) {
2622 PAPIERROR(
"read(%d): short %d vs. %d bytes", fd, ret,
sizeof ( msg ) );
2625#if defined(HAVE_PFM_MSG_TYPE)
2627 SUBDBG(
"PFM_MSG_END\n" );
2636 SUBDBG(
"PFM_MSG_END\n" );
2660 strerror(
errno ) );
2675 unsigned int hwcntr;
2685 SUBDBG(
"Found hw counter %d in %d, flags %d\n", hwcntr,
i,
2751 SUBDBG(
"Hardware counter %d used in overflow, threshold %d\n", j,
2765 this_state->pd[j].reg_value = 0;
2766 this_state->pd[j].reg_long_reset = 0;
2767 this_state->pd[j].reg_short_reset = 0;
2779 this_state->pd[j].reg_value =
2780 ( ~0UL ) - (
unsigned long )
threshold + 1;
2781 this_state->pd[j].reg_short_reset =
2782 ( ~0UL ) - (
unsigned long )
threshold + 1;
2783 this_state->pd[j].reg_long_reset =
2784 ( ~0UL ) - (
unsigned long )
threshold + 1;
2804 strncpy( ntv_name,
name, len );
2815#if defined(HAVE_PFM_GET_EVENT_DESCRIPTION)
2828 switch ( modifier ) {
2875 evt = &( ptr->
evt );
2895 evt = &( ptr->
evt );
2917 evt = &( ptr->
evt );
2945 PAPIERROR(
"PMU type %d is not supported by this component",
2955 ( void ) this_state;
2956 ( void ) nativeInfo;
2969 unsigned int i, j, event, umask, EventCode;
2993 SUBDBG(
" original count is %d\n", org_cnt );
2997 memset( &gete, 0,
sizeof ( gete ) );
2998 EventCode =
native[
i].ni_event;
3003 SUBDBG(
" evtcode=%#x evtindex=%d name: %s\n", EventCode, event,
3019 SUBDBG(
"pfmw_dispatch_events fail\n" );
3033 SUBDBG(
"event_code is %d, reg_num is %d\n",
3071 SUBDBG(
" original count is %d\n", org_cnt );
3081 SUBDBG(
"pfmw_dispatch_events fail\n" );
3095 SUBDBG(
"event_code is %d, reg_num is %d\n",
3122 PAPIERROR(
"PMU type %d is not supported by this component",
3130 .
name =
"perfmon-ia64.c",
3141 .fast_real_timer = 1,
3142 .fast_virtual_timer = 0,
3144 .attach_must_ptrace = 0,
3145 .kernel_profile = 1,
#define GET_OVERFLOW_ADDRESS(ctx)
PAPI_os_info_t _papi_os_info
#define MAX_COUNTER_TERMS
int open(const char *pathname, int flags, mode_t mode)
ssize_t read(int fd, void *buf, size_t count)
static pid_t mygettid(void)
volatile int buf[CACHE_FLUSH_BUFFER_SIZE_INTS]
#define PAPI_INSTR_ADDRESS
#define PAPI_NTV_ENUM_UMASK_COMBOS
#define PAPI_NTV_ENUM_IEAR
#define PAPI_OVERFLOW_FORCE_SW
#define PAPI_NTV_ENUM_UMASKS
#define PAPI_2MAX_STR_LEN
#define PAPI_NTV_ENUM_OPCM
#define PAPI_DATA_ADDRESS
#define PAPI_OVERFLOW_HARDWARE
#define PAPI_NTV_ENUM_DEAR
#define PAPI_PROFIL_FORCE_SW
#define PAPI_NTV_ENUM_DARR
#define PAPI_NTV_ENUM_IARR
#define PAPI_DEF_ITIMER_NS
char events[MAX_EVENTS][BUFSIZ]
static long long values[NUM_EVENTS]
#define PFM_VERSION_MAJOR(x)
#define PFM_REGFL_OVFL_NOTIFY
int _linux_get_memory_info(PAPI_hw_info_t *hwinfo, int cpu_type)
#define PAPI_NATIVE_AND_MASK
#define PAPI_MAX_PRESET_EVENTS
Return codes and api definitions.
#define SUBDBG(format, args...)
__sighandler_t signal(int __sig, __sighandler_t __handler) __attribute__((__nothrow__
void PAPIERROR(char *format,...)
int _papi_hwi_setup_all_presets(hwi_search_t *findem, int cidx)
papi_mdi_t _papi_hwi_system_info
#define PFMW_PEVT_PFPPC_REG_VAL(evt, idx)
static itanium_preset_search_t ia1_preset_search_map[]
int _ia64_start(hwd_context_t *ctx, hwd_control_state_t *current_state)
#define PFMON_ITA2_MAX_IBRS
static int set_default_granularity(hwd_control_state_t *this_state, int granularity)
static int ia64_process_profile_buffer(ThreadInfo_t *thread, EventSetInfo_t *ESI)
unsigned int PAPI_NATIVE_EVENT_AND_MASK
static int pfmw_support_iarr(unsigned int i)
static int _ia64_modify_event(unsigned int event, int modifier)
static char * search_cpu_info(FILE *f, char *search_str, char *line)
int _perfmon2_pfm_pmu_type
int _ia64_update_control_state(hwd_control_state_t *this_state, NativeInfo_t *native, int count, hwd_context_t *zero)
int _ia64_set_overflow(EventSetInfo_t *ESI, int EventIndex, int threshold)
static int pfmw_support_darr(unsigned int i)
#define PFMW_PEVT_EVENT(evt, idx)
static int pfmw_is_iear(unsigned int i)
static int pfmw_is_dear(unsigned int i)
static void pfmw_get_event_description(unsigned int idx, char *dest, int len)
void _ia64_dispatch_timer(int signal, hwd_siginfo_t *info, void *context)
static int pfmw_support_opcm(unsigned int i)
int _ia64_ita_init_control_state(hwd_control_state_t *this_state)
static int pfmw_get_num_events(int *num)
pfm_default_smpl_entry_t pfmw_smpl_entry_t
static int set_default_domain(hwd_control_state_t *this_state, int domain)
static int _pfm_decode_native_event(unsigned int EventCode, unsigned int *event, unsigned int *umask)
int _ia64_ita_set_domain(hwd_control_state_t *this_state, int domain)
static int set_notify(EventSetInfo_t *ESI, int index, int value)
#define PFMW_PEVT_PFPPC_COUNT(evt)
int _ia64_ita_read(hwd_context_t *ctx, hwd_control_state_t *machdep, long long **events, int flags)
#define PFMW_PEVT_PFPPD(evt)
int _ia64_init_control_state(hwd_control_state_t *this_state)
static int pfmw_get_event_name(char *name, unsigned int idx)
static void pfmw_stop(hwd_context_t *ctx)
papi_vector_t _ia64_vector
int _ia64_ntv_enum_events(unsigned int *EventCode, int modifier)
static int pfmw_create_ctx_common(hwd_context_t *ctx)
static int encode_native_event_raw(unsigned int event, unsigned int mask)
int _papi_pfm_ntv_enum_events(unsigned int *EventCode, int modifier)
pfm_default_smpl_hdr_t pfmw_smpl_hdr_t
static int set_granularity(hwd_control_state_t *this_state, int domain)
static void ia64_dispatch_sigprof(int n, hwd_siginfo_t *info, hwd_ucontext_t *sc)
int _ia64_ita_update_control_state(hwd_control_state_t *this_state, NativeInfo_t *native, int count, hwd_context_t *zero)
static itanium_preset_search_t ia3_preset_search_map[]
static int ia64_ita_process_profile_buffer(ThreadInfo_t *thread, EventSetInfo_t *ESI)
int _ia64_ita2_init_control_state(hwd_control_state_t *this_state)
static int ia64_mont_process_profile_buffer(ThreadInfo_t *thread, EventSetInfo_t *ESI)
unsigned int PAPI_NATIVE_UMASK_AND_MASK
int _ia64_mont_set_domain(hwd_control_state_t *this_state, int domain)
int _ia64_ntv_code_to_name(unsigned int EventCode, char *ntv_name, int len)
static int prepare_umask(unsigned int foo, unsigned int *values)
#define PFMON_MONT_MAX_IBRS
unsigned int PAPI_NATIVE_EVENT_SHIFT
static int set_irange(hwd_context_t *ctx, hwd_control_state_t *current_state, _papi_int_option_t *option)
unsigned int PAPI_NATIVE_UMASK_SHIFT
static int set_inherit(int arg)
static int pfmw_dispatch_events(pfmw_param_t *evt)
int _ia64_init_component(int cidx)
static int ia64_ita2_process_profile_buffer(ThreadInfo_t *thread, EventSetInfo_t *ESI)
static void check_ibrp_events(hwd_control_state_t *current_state)
int _ia64_ctl(hwd_context_t *zero, int code, _papi_int_option_t *option)
int _ia64_set_domain(hwd_control_state_t *this_state, int domain)
int _ia64_shutdown(hwd_context_t *ctx)
int _ia64_read(hwd_context_t *ctx, hwd_control_state_t *machdep, long long **events, int flags)
#define PFMW_PEVT_EVTCOUNT(evt)
int _ia64_stop(hwd_context_t *ctx, hwd_control_state_t *zero)
int _ia64_init(hwd_context_t *zero)
int _papi_pfm_ntv_code_to_descr(unsigned int EventCode, char *ntv_descr, int len)
static itanium_preset_search_t ia2_preset_search_map[]
int _ia64_ita23_read(hwd_context_t *ctx, hwd_control_state_t *machdep, long long **events, int flags)
int _ia64_mont_update_control_state(hwd_control_state_t *this_state, NativeInfo_t *native, int count, hwd_context_t *zero)
#define PFMW_ARCH_REG_PMCVAL(reg)
static int round_requested_ns(int ns)
static int pfmw_destroy_context(hwd_context_t *thr_ctx)
int _ia64_ita2_set_domain(hwd_control_state_t *this_state, int domain)
int _ia64_reset(hwd_context_t *ctx, hwd_control_state_t *machdep)
static int pfmw_get_num_counters(int *num)
#define PFMW_PEVT_PFPPC_REG_FLG(evt, idx)
void _ia64_remove_native(hwd_control_state_t *this_state, NativeInfo_t *nativeInfo)
int generate_preset_search_map(hwi_search_t **maploc, itanium_preset_search_t *oldmap, int num_cnt)
int _ia64_ntv_code_to_descr(unsigned int EventCode, char *ntv_descr, int len)
int _ia64_set_profile(EventSetInfo_t *ESI, int EventIndex, int threshold)
static int pfmw_create_context(hwd_context_t *thr_ctx)
static void pfmw_start(hwd_context_t *ctx)
static int set_pmds_to_write(EventSetInfo_t *ESI, int index, unsigned long value)
static int pfmw_recreate_context(EventSetInfo_t *ESI, hwd_context_t *thr_ctx, void **smpl_vaddr, int EventIndex)
int _ia64_mont_init_control_state(hwd_control_state_t *this_state)
static int install_irange(hwd_context_t *pctx, hwd_control_state_t *current_state)
int _ia64_stop_profiling(ThreadInfo_t *thread, EventSetInfo_t *ESI)
unsigned int PAPI_NATIVE_UMASK_MAX
static int set_drange(hwd_context_t *ctx, hwd_control_state_t *current_state, _papi_int_option_t *option)
#define PFMW_PEVT_PFPPC_REG_NUM(evt, idx)
static int _papi_pfm_ntv_name_to_code(const char *name, unsigned int *event_code)
#define PFMW_PEVT_DFLPLM(evt)
static int install_drange(hwd_context_t *pctx, hwd_control_state_t *current_state)
hwi_search_t * preset_search_map
#define PFMW_PEVT_PFPPC(evt)
int _papi_pfm_ntv_code_to_name(unsigned int EventCode, char *ntv_name, int len)
static int pfmw_perfmonctl(pid_t tid, int fd, int cmd, void *arg, int narg)
#define MONT_ETB_REGS_MASK
#define MONT_DEAR_REGS_MASK
#define PMU_FIRST_COUNTER
unsigned char pfm_uuid_t[16]
#define PFM_CREATE_CONTEXT
int perfmonctl(int fd, int cmd, void *arg, int narg)
#define PFM_DEFAULT_SMPL_UUID
char * pfm_strerror(int code)
pfm_err_t pfm_dispatch_events(pfmlib_input_param_t *p, void *model_in, pfmlib_output_param_t *q, void *model_out)
pfm_err_t pfm_get_num_events(unsigned int *count)
pfm_err_t pfm_get_event_mask_description(unsigned int event_idx, unsigned int mask_idx, char **desc)
pfm_err_t pfm_get_full_event_name(pfmlib_event_t *e, char *name, size_t maxlen)
pfm_err_t pfm_get_event_name(unsigned int idx, char *name, size_t maxlen)
pfm_err_t pfm_get_event_description(unsigned int idx, char **str)
pfm_err_t pfm_find_event_byname(const char *name, unsigned int *idx)
pfm_err_t pfm_initialize(void)
#define PFMLIB_ITANIUM2_PMU
pfm_err_t pfm_find_full_event(const char *str, pfmlib_event_t *e)
#define PFMLIB_MONTECITO_PMU
pfm_err_t pfm_get_pmu_type(int *type)
pfm_err_t pfm_get_event_code(unsigned int idx, int *code)
pfm_err_t pfm_get_num_event_masks(unsigned int event_idx, unsigned int *count)
#define PFMLIB_ITANIUM_PMU
pfm_err_t pfm_get_version(unsigned int *version)
pfm_err_t pfm_find_event(const char *str, unsigned int *idx)
pfm_err_t pfm_set_options(pfmlib_options_t *opt)
pfm_err_t pfm_get_num_counters(unsigned int *num)
int pfm_ita2_support_darr(unsigned int i)
int pfm_ita2_support_iarr(unsigned int i)
int pfm_ita2_support_opcm(unsigned int i)
int pfm_ita2_is_iear(unsigned int i)
int pfm_ita2_get_event_umask(unsigned int i, unsigned long *umask)
int pfm_ita2_irange_is_fine(pfmlib_output_param_t *outp, pfmlib_ita2_output_param_t *mod_out)
int pfm_ita2_is_btb(unsigned int i)
int pfm_ita2_is_dear(unsigned int i)
int pfm_ita_support_iarr(unsigned int i)
int pfm_ita_is_btb(unsigned int i)
int pfm_ita_support_darr(unsigned int i)
int pfm_ita_support_opcm(unsigned int i)
int pfm_ita_is_dear(unsigned int i)
int pfm_ita_is_iear(unsigned int i)
int pfm_mont_irange_is_fine(pfmlib_output_param_t *outp, pfmlib_mont_output_param_t *mod_out)
int pfm_mont_support_opcm(unsigned int i)
int pfm_mont_get_event_umask(unsigned int i, unsigned long *umask)
int pfm_mont_support_darr(unsigned int i)
int pfm_mont_support_iarr(unsigned int i)
int pfm_mont_is_etb(unsigned int i)
int pfm_mont_is_dear(unsigned int i)
int pfm_mont_is_iear(unsigned int i)
static int pfm_self_stop(int fd)
static int pfm_self_start(int fd)
int pos[PAPI_EVENTS_IN_DERIVED_EVENT]
EventSetProfileInfo_t profile
struct _ThreadInfo * master
EventInfo_t * EventInfoArray
hwd_control_state_t * ctl_state
NativeInfo_t * NativeInfoArray
EventSetOverflowInfo_t overflow
char support_version[PAPI_MIN_STR_LEN]
char kernel_version[PAPI_MIN_STR_LEN]
char name[PAPI_MAX_STR_LEN]
hwd_ucontext_t * ucontext
char operation[PAPI_2MAX_STR_LEN]
int native[PAPI_EVENTS_IN_DERIVED_EVENT]
pfmw_ita_param_t ita_lib_param
char operation[MAX_COUNTERS *5]
char * findme[MAX_COUNTERS]
PAPI_component_info_t cmp_info
int(* set_overflow)(EventSetInfo_t *, int, int)
pfm_uuid_t ctx_smpl_buf_id
unsigned long dbreg_value
unsigned long reg_smpl_pmds[4]
pfm_default_smpl_arg_t buf_arg
unsigned int unit_masks[PFMLIB_MAX_MASKS_PER_EVENT]
pfmlib_ita2_output_rr_t pfp_ita2_irange
pfmlib_ita2_output_rr_t pfp_ita2_drange
pfmlib_ita2_output_rr_desc_t rr_infos[4]
pfmlib_mont_output_rr_t pfp_mont_irange
pfmlib_mont_output_rr_t pfp_mont_drange
pfmlib_mont_output_rr_desc_t rr_infos[4]
pfmlib_reg_t pfp_pmds[PFMLIB_MAX_PMDS]
pfmlib_reg_t pfp_pmcs[PFMLIB_MAX_PMCS]
unsigned int pfp_pmc_count
unsigned int pfp_pmd_count
unsigned long long reg_value
pfmlib_ita2_output_param_t ita2_output_param
pfmlib_ita2_input_param_t ita2_input_param
pfmlib_mont_input_param_t mont_input_param
pfmlib_mont_output_param_t mont_output_param
pfmlib_output_param_t outp
inline_static ThreadInfo_t * _papi_hwi_lookup_thread(int custom_tid)
_papi_int_domain_t domain
_papi_int_multiplex_t multiplex
_papi_int_granularity_t granularity
_papi_int_inherit_t inherit
_papi_int_itimer_t itimer
_papi_int_addr_range_t address_range
struct pfm_ita2_pmc_reg_t::@44 pmc_ita2_counter_reg
struct pfm_ita2_pmd_reg_t::@61 pmd17_ita2_reg
struct pfm_ita_pmc_reg_t::@30 pmc_ita_count_reg
struct pfm_ita_pmd_reg_t::@43 pmd17_ita_reg
struct pfm_mont_pmc_reg_t::@62 pmc_mont_counter_reg
struct pfm_mont_pmd_reg_t::@78 pmd36_mont_reg
pfm_ovfl_msg_t pfm_ovfl_msg
pfm_gen_msg_t pfm_gen_msg
pfmw_mont_param_t mont_param
pfmw_ita1_param_t ita_param
pfmw_ita2_param_t ita2_param