Re: [PATCH v2] perf vendor events arm64: Add AmpereOne metrics

From: James Clark
Date: Tue Aug 29 2023 - 06:47:25 EST




On 26/08/2023 20:23, Ilkka Koskinen wrote:
> This patch adds AmpereOne metrics. The metrics also work around
> the issue related to some of the events.
>
> Signed-off-by: Ilkka Koskinen <ilkka@xxxxxxxxxxxxxxxxxxxxxx>
> ---
> .../arch/arm64/ampere/ampereone/metrics.json | 396 ++++++++++++++++++
> 1 file changed, 396 insertions(+)
> create mode 100644 tools/perf/pmu-events/arch/arm64/ampere/ampereone/metrics.json
>
> diff --git a/tools/perf/pmu-events/arch/arm64/ampere/ampereone/metrics.json b/tools/perf/pmu-events/arch/arm64/ampere/ampereone/metrics.json
> new file mode 100644
> index 000000000000..b623d8a9e3dc
> --- /dev/null
> +++ b/tools/perf/pmu-events/arch/arm64/ampere/ampereone/metrics.json
> @@ -0,0 +1,396 @@

[...]

> + {
> + "MetricExpr": "STALL_SLOT_BACKEND / (CPU_CYCLES * 4)",
> + "BriefDescription": "Fraction of slots backend bound",
> + "MetricGroup": "Default;TopDownL1",
> + "MetricName": "backend_bound",
> + "ScaleUnit": "100%"
> + },

Hi Ilkaa,

For these topdown metrics, as long as they are the same as the standard
one you can remove anything that is duplicated. This might make it
easier to make changes across all the topdown metrics in the future and
have consistent descriptions across CPUs. For example this backend_bound
one could look like this:

{
"ArchStdEvent": "backend_bound",
}

This assumes that you have the slots sysfs file available, otherwise you
could leave only the formula in.

We also decided to make the units for the topdown metrics "percent of
slots" as we thought more specificity in the units was clearer.

Thanks
James

> + {
> + "MetricExpr": "1 - (retired_fraction + slots_lost_misspeculation_fraction + backend_bound)",
> + "BriefDescription": "Fraction of slots frontend bound",
> + "MetricGroup": "Default;TopDownL1",
> + "MetricName": "frontend_bound",
> + "ScaleUnit": "100%"
> + },
> + {
> + "MetricExpr": "(OP_SPEC - OP_RETIRED) / (CPU_CYCLES * 4)",
> + "BriefDescription": "Fraction of slots lost due to misspeculation",
> + "MetricGroup": "Default;TopDownL1",
> + "MetricName": "slots_lost_misspeculation_fraction",
> + "ScaleUnit": "100%"
> + },
> + {
> + "MetricExpr": "OP_RETIRED / (CPU_CYCLES * 4)",
> + "BriefDescription": "Fraction of slots retiring, useful work",
> + "MetricGroup": "Default;TopDownL1",
> + "MetricName": "retired_fraction",
> + "ScaleUnit": "100%"
> + },
> + {