I can not find any instructions on how to compile a list
of human readable event mappings that libpfm4's pfm_get_os_event_encoding()
will map to the corresponding values that i can pass to rdpmc
. Every time i try anything but cycles
or instructions
from e.g the output of perf list
libpfm4 can't find it.
EDIT/SOLUTION: There is example code hidden in the docs to list available events for every PMU:
void list_pmu_events(pfm_pmu_t pmu)
{
pfm_event_info_t info;
pfm_pmu_info_t pinfo;
int i, ret;
memset(&info, 0, sizeof(info));
memset(&pinfo, 0, sizeof(pinfo));
info.size = sizeof(info);
pinfo.size = sizeof(pinfo);
ret = pfm_get_pmu_info(pmu, &pinfo);
if (ret != PFM_SUCCESS)
return;
errx(1, "cannot get pmu info");
for (i = pinfo.first_event; i != -1; i = pfm_get_event_next(i)) {
ret = pfm_get_event_info(i, PFM_OS_PERF_EVENT_EXT, &info);
if (ret != PFM_SUCCESS)
errx(1, "cannot get event info");
if (pfm_find_event(info.name) && pinfo.is_present) {
printf("Event: %s::%s\n",
pinfo.name, info.name);
}
}
}