X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=rts%2FPapi.c;h=f72660428b3fe1b1f1ee7d49716801b45b5f1cdc;hb=888b4e89a4a4e3f39a3ba567c796b3a79b63bf61;hp=e62fc9595c6a7c967a4f00520f1dd215de5b9a82;hpb=a2a67cd520b9841114d69a87a423dabcb3b4368e;p=ghc-hetmet.git diff --git a/rts/Papi.c b/rts/Papi.c index e62fc95..f726604 100644 --- a/rts/Papi.c +++ b/rts/Papi.c @@ -74,6 +74,7 @@ int papi_error; /* Arbitrary, to avoid using malloc */ #define MAX_PAPI_EVENTS 10 +static char papiNativeEventNames[MAX_PAPI_EVENTS][PAPI_MAX_STR_LEN]; static nat n_papi_events = 0; @@ -86,10 +87,10 @@ long_long GC0Counters[MAX_PAPI_EVENTS]; long_long GC1Counters[MAX_PAPI_EVENTS]; long_long start_mutator_cycles; -long_long mutator_cycles; +long_long mutator_cycles = 0; long_long start_gc_cycles; -long_long gc0_cycles; -long_long gc1_cycles; +long_long gc0_cycles = 0; +long_long gc1_cycles = 0; @@ -145,11 +146,20 @@ init_countable_events(void) } else if (RtsFlags.PapiFlags.eventType==PAPI_USER_EVENTS) { nat i; char *name; + char *asciiEventCode; int code; for (i = 0; i < RtsFlags.PapiFlags.numUserEvents; i++) { + if(RtsFlags.PapiFlags.userEventsKind[i] == PAPI_PRESET_EVENT_KIND) { name = RtsFlags.PapiFlags.userEvents[i]; PAPI_CHECK(PAPI_event_name_to_code(name, &code)) - papi_add_event(name, code); + } + else { // PAPI_NATIVE_EVENT_KIND + asciiEventCode = RtsFlags.PapiFlags.userEvents[i]; + name = papiNativeEventNames[i]; + code = strtol(asciiEventCode, NULL, 16 /* hex number expected */); + PAPI_CHECK(PAPI_event_code_to_name(code, name)) + } + papi_add_event(name, code); } } else { // PAPI_ADD_EVENT(PAPI_L1_DCA); // L1 data cache accesses @@ -180,10 +190,10 @@ init_countable_events(void) static void -papi_report_event(const char *name, ullong value) +papi_report_event(const char *name, StgWord64 value) { static char temp[BIG_STRING_LEN]; - ullong_format_string(value,temp,rtsTrue/*commas*/); + showStgWord64(value,temp,rtsTrue/*commas*/); statsPrintf(" %15s %15s\n", name, temp); }