I am using papi-5.1.0 on Intel Q9400 ubuntu desktop.
I am trying to monitor native event (shown by ./util/papi_native_avail) perf::CPU-CYCLES of perf_event component, which I add to eventset by using PAPI_event_name_to_code function:
- Code: Select all
retval = PAPI_event_name_to_code("perf::CPU-CYCLES", &event_code);
For this event, the returned event code is 0x40000025
To enumerate and list all available components and events, I use following code:
- Code: Select all
numcmp = PAPI_num_components();
printf("numcmp = %d\n", numcmp);
for (cmp_idx = 0; cmp_idx < numcmp ; cmp_idx++) {
cmp_info = PAPI_get_component_info(cmp_idx);
if (cmp_info == NULL) {
handle_error(1);
}
code = PAPI_NATIVE_MASK;
r = PAPI_enum_cmp_event(&code, PAPI_ENUM_FIRST, cmp_idx);
while (r == PAPI_OK) {
retval = PAPI_event_code_to_name(code, event_name);
if (retval != PAPI_OK) {
printf("PAPI_event_code_to_name return error(%d) in %s\n", retval, __func__);
}
printf("0x%x %s\n", code, event_name);
total_events++;
r = PAPI_enum_cmp_event(&code, PAPI_ENUM_EVENTS, cmp_idx);
}
}
The output of this code snippet for perf::CPU-CYCLES is
0x400000a3 perf::CPU-CYCLES
As you can see the code is different from code returned by PAPI_event_code_to_name() function (0x40000025).
Could anyone please clarify where is my mistake and misunderstanding? I need to monitor perf::* native events.
Another question is, what is the difference between following 3 events perf::PERF_COUNT_HW_CPU_CYCLES, perf::CYCLES and perf::CPU-CYCLES?
Thank you in advance!
Perveance
