Re: [PATCH v1] perf stat: Introduce skippable evsels

From: Liang, Kan
Date: Thu Apr 13 2023 - 09:40:34 EST




On 2023-04-12 2:01 p.m., Ian Rogers wrote:
>> - We shouldn't only rely on the event list file. We need to do runtime
>> check on the availability of events. Either perf_event_open() or
>> /sys/devices/cpu/events/ is fine (althourh personally I prefer sys way,
>> since I think it's easier).
> Using perf_event_open is the status quo and the sysfs approach is
> impractical imo. I think the only thing that is needed in v2 is for
> <not counted> to be displayed for skippable evsels.

Using perf_event_open is good to check features. If the feature is not
supported by the kernel, it will be explicitly rejected.
But I'm not sure about the availability of events. The kernel doesn't
check every events. For example, on ICL and later platform, we have
event=0x00,umask=0x8X for all the topdown metrics events. If we open
them on SKL, the perf_event_open will also success, but return 0 value.

Thanks,
Kan