When I run perf list on my Linux system I get a long list of available perf events.
Is it possible to list and use these events programatically from another process, using perf_event_open(2)? That is, how can I get this list from another process and determine the corresponding values to populate in perf_event_attr?
I'm not looking for solutions that use another third-party listing of the events, e.g,. libpfm4 or jevents. I know some events can be reconstructed from the files in /sys/devices/cpu/events/ (and similar files for other event types), but these are a small subset of the events that perf list shows.