Re: [PATCHv4 00/19] perf metric: Add support to reuse metric

From: John Garry
Date: Mon Mar 22 2021 - 07:39:49 EST


On 01/08/2020 12:40, Paul A. Clarke wrote:
v4 changes:
- removed acks from patch because it changed a bit
with the last fixes:
perf metric: Collect referenced metrics in struct metric_ref_node
- fixed runtime metrics [Kajol Jain]
- increased recursion depth [Paul A. Clarke]
- changed patches due to dependencies:
perf metric: Collect referenced metrics in struct metric_ref_node
perf metric: Add recursion check when processing nested metrics
perf metric: Rename struct egroup to metric
perf metric: Rename group_list to metric_list

Also available in here:
git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
perf/metric
I built and ran from the above git branch, and things seem to work.
Indeed, I was able to apply my changes to exploit the new capabilities
via modifications to tools/perf/pmu-events/arch/powerpc/power9/metrics.json,
as I posted earlier (and will submit once this set gets merged).


Hi Paul,

I was just wondering: Does perf subtest 10.3 work ok for you with the metric reuse?

That's "Parsing of PMU event table metrics" subtest.

Hi Jirka,

If I add something like this:
{
"BriefDescription": "dummy test1",
"MetricExpr": "Bad_Speculation + Frontend_Bound",
"MetricGroup": "TopdownL1",
"MetricName": "dummytest",
"PublicDescription": "dummy test2"
},

I get "Parse event failed metric 'dummytest' id 'bad_speculation' expr 'bad_speculation + frontend_bound'"

Thanks,
john

Tested-by: Paul A. Clarke<pc@xxxxxxxxxx>

One thing I noted, but which also occurs without these patches, is that
the perf metrics are not computed unless run as root:
--
$ perf stat --metrics br_misprediction_percent command

Performance counter stats for 'command':

1,823,530,051 pm_br_pred:u
2,662,705 pm_br_mpred_cmpl:u

$ /usr/bin/sudo perf stat --metrics br_misprediction_percent command

Performance counter stats for 'command':

1,824,655,269 pm_br_pred # 0.09 br_misprediction_percent
1,654,466 pm_br_mpred_cmpl
--