Re: [PATCH v1] perf metrics: Make common stalled metrics conditional on having the event

From: Namhyung Kim

Date: Fri Apr 03 2026 - 20:15:37 EST


On Wed, 18 Mar 2026 18:01:03 -0700, Ian Rogers wrote:
> The metric code uses the event parsing code but it generally assumes
> all events are supported. Arnaldo reported AMD supporting
> stalled-cycles-frontend but not stalled-cycles-backend [1]. An issue
> with this is that before parsing happens the metric code tries to
> share events within groups to reduce the number of events and
> multiplexing. If the group has some supported and not supported
> events, the whole group will become broken. To avoid this situation
> add has_event tests to the metrics for stalled-cycles-frontend and
> stalled-cycles-backend. has_events is evaluated when parsing the
> metric and its result constant propagated (with if-elses) to reduce
> the number of events. This means when the metric code considers
> sharing the events, only supported events will be shared.
>
> [...]
Applied to perf-tools-next, thanks!

Best regards,
Namhyung