Thread (33 messages) 33 messages, 7 authors, 2022-02-08

Re: [RFC PATCH 1/1] perf arm64: Implement --topdown with metrics

From: John Garry <hidden>
Date: 2021-12-15 10:52:54
Also in: linux-arm-kernel, lkml

Hi Andrew,
quoted
  const struct pmu_event *metricgroup__find_metric(const char *metric,
                                                  const struct pmu_events_map *map);
  int metricgroup__parse_groups_test(struct evlist *evlist,
diff --git a/tools/perf/util/topdown.c b/tools/perf/util/topdown.c
index 1081b20f9891..57c0c5f2c6bd 100644
--- a/tools/perf/util/topdown.c
+++ b/tools/perf/util/topdown.c
@@ -56,3 +56,9 @@ __weak bool arch_topdown_sample_read(struct evsel *leader __maybe_unused)
  {
         return false;
  }
+
+__weak bool arch_topdown_use_json_metrics(void)
+{
AFAICS, only x86 supports topdown today and that is because they have 
special kernel topdown events exposed for the kernel CPU PMU driver. So 
other architectures - not only arm - would need rely on metricgroups for 
topdown support. So let's make this generic for all archs.
I like this extension! I've ranted in the past about weak symbols
breaking with archives due to lazy loading [1]. In this case
tools/perf/arch/arm64/util/topdown.c has no other symbols within it
and so the weak symbol has an extra chance of being linked
incorrectly. We could add a new command line of --topdown-json to
avoid this, but there seems little difference in doing this over just
doing '-M TopDownL1'.
Is it possible to use the json metric approach
for when the CPU version fails?
I think that's a good idea.

In addition we could also add a --topdown arg to force using JSON 
metricgroups.

Did you actually test this patch? I have something experimental working 
from some time ago, and it was more complicated than this. I need to 
check the code again...

Thanks,
John
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help