Hello,
I am encountering an issue where the pfm_get_os_event_encoding() API could
not find l3_misses or l3_accesses perf events by running the following
simple code:
~$ pfm_test l3_misses 0
pfm_test: cannot get encoding: event not found
~$ pfm_test cache-misses 0
cache-misses event supported by libpfm
```
#include <err.h>
#include <inttypes.h>
#include <perfmon/pfmlib.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char **argv)
{
pfm_pmu_encode_arg_t arg;
int ret;
char *event_name;
int os_encoding;
if (argc != 3) {
fprintf(stderr, "Usage: %s <event_name> <os_encoding>\n", argv[0]);
return 1;
}
event_name =argv[1];
os_encoding = atoi(argv[2]);
ret = pfm_initialize();
if (ret != PFM_SUCCESS)
errx(1, "cannot initialize library %s", pfm_strerror(ret));
memset(&arg, 0, sizeof(arg));
char* fqstr = malloc(256);
if (!fqstr) {
errx(1, "Failed to allocate memory for fully qualified string");
}
arg.fstr = &fqstr;
arg.size = sizeof(arg);
ret = pfm_get_os_event_encoding(event_name, PFM_PLM0|PFM_PLM3,
os_encoding, &arg);
if (ret != PFM_SUCCESS)
errx(1, "cannot get encoding: %s", pfm_strerror(ret));
else
printf("%s event supported by libpfm\n", event_name);
free(fqstr);
return 0;
}
However, these events can be successfully monitored using the perf CLI tool:
```
~$sudo perf stat -a -e l3_misses,l3_accesses -- sleep 1
Performance counter stats for 'system wide':
1,122,395,814 l3_misses
4,398,985,531 l3_accesses
1.005054759 seconds time elapsed
```
The environment is running on a kernel version 6.1 with an AMD EPYC 7642
48-Core Processor.
Any suggestions?
_______________________________________________
perfmon2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/perfmon2-devel