Re: [PATCH v3 2/7] perf metric: Event "Compat" value supports matching multiple identifiers
From: John Garry
Date: Mon Jun 19 2023 - 03:08:45 EST
On 19/06/2023 03:58, Jing Zhang wrote:
+++ b/tools/perf/pmu-events/arch/arm64/arm/cmn/sys/metrics.json
@@ -0,0 +1,74 @@
+[
+ {
+ "MetricName": "slc_miss_rate",
+ "BriefDescription": "The system level cache miss rate include.",
+ "MetricGroup": "arm_cmn",
+ "MetricExpr": "hnf_cache_miss / hnf_slc_sf_cache_access",
So this expression uses event aliases hnf_cache_miss and hnf_slc_sf_cache_access - where are they defined in a JSON?
Hi John,
I defined the aliases for these events in the JSON file during the RFC version. However, I later removed the alias
definitions for these events in subsequent versions due to the possibility of non-uniqueness and difficulty in defining
their EventCode. But this does not affect their usage in metrics. In other words, metrics can use the aliases without
defining event aliases in the JSON file.
Really? So how can we resolve the event aliases when we try to run the
metric?
Please verify running these metrics with 'perf stat', like 'perf stat -v
-M slc_miss_rate'
In the past, I always thought that the function of the alias was to explain the meaning of these events in the perf list.
Or maybe I'm missing something?
Event aliases do give the ability to describe the event in perf list.
But we can also run them for 'perf stat', like:
./perf list uncore
List of pre-defined events (to be used in -e or -M):
uncore_cbox_0/clockticks/ [Kernel PMU event]
uncore_cbox_1/clockticks/ [Kernel PMU event]
uncore_imc/data_reads/ [Kernel PMU event]
uncore_imc/data_writes/ [Kernel PMU event]
uncore_imc/gt_requests/ [Kernel PMU event]
uncore_imc/ia_requests/ [Kernel PMU event]
uncore_imc/io_requests/ [Kernel PMU event]
uncore cache:
unc_cbo_cache_lookup.any_es
[L3 Lookup any request that access cache and found line in E or
S-state. Unit: uncore_cbox]
...
sudo ./perf stat -v -e unc_cbo_cache_lookup.any_es
Using CPUID GenuineIntel-6-3D-4
unc_cbo_cache_lookup.any_es -> uncore_cbox_0/event=0x34,umask=0x86/
unc_cbo_cache_lookup.any_es -> uncore_cbox_1/event=0x34,umask=0x86/
Control descriptor is not initialized
^Cunc_cbo_cache_lookup.any_es: 14361103 1853372468 1853372468
unc_cbo_cache_lookup.any_es: 14322188 1853360415 1853360415
Performance counter stats for 'system wide':
14,361,103 unc_cbo_cache_lookup.any_es
14,322,188 unc_cbo_cache_lookup.any_es
1.853388227 seconds time elapsed
Thanks,
John