I am trying to read one of the Hardware counters with PAPI. When I try to read events from perf_event
list, it works fine.
However now I need to read one of the counters from perf_event_uncore
list, which is obtained with papi_native_avail
, but I get an error.
It's running on cascade lake architecture, with linux 5.4.0-3-amd64 version.
int err = PAPI_event_name_to_code("skx_unc_imc0::UNC_M_WPQ_CYCLES_FULL",&native);
if (err != PAPI_OK)
printf("PAPI_event_name_to_code error: %d\n", err);
err = PAPI_add_event(EventSet, native);
if (err!= PAPI_OK)
printf("PAPI_add_event error: %d\n", err);
Even though PAPI_event_name_to_code
returns PAPI_OK, PAPI_add_event
returns -1 which is PAPI_EINVAL
- Invalid argument. I tried several counters form perf_event_uncore
and I got the same problem. Do I need to use different function to add this even to the eventset? or is there something else that I am doing wrong?
I found something that seems to be a solution. After adding cpu=0 specification like this: PAPI_event_name_to_code("skx_unc_imc0::UNC_M_WPQ_CYCLES_FULL:cpu=0",&native)
there is no furhter error while calling PAPI_add_event
function.
Also to note, I have checked and this specific hardware counter can't be counted with others, so it should be the only event in the eventset.