On Tue, Jul 21, 2020 at 09:48:48AM -0500, Paul A. Clarke wrote:
> On Sun, Jul 19, 2020 at 08:13:01PM +0200, Jiri Olsa wrote:
> > hi,
> > this patchset is adding the support to reused metric in
> > another metric.
> > 
> > For example, to define IPC by using CPI with change like:
> > 
> >      {
> >          "BriefDescription": "Instructions Per Cycle (per Logical 
> > Processor)",
> > -        "MetricExpr": "INST_RETIRED.ANY / CPU_CLK_UNHALTED.THREAD",
> > +        "MetricExpr": "1/CPI",
> >          "MetricGroup": "TopDownL1",
> >          "MetricName": "IPC"
> >      },
> > 
> > I won't be able to find all the possible places we could
> > use this at, so I wonder you guys (who was asking for this)
> > would try it and come up with comments if there's something
> > missing or we could already use it at some places.
> > 
> > It's based on Arnaldo's tmp.perf/core.
> > 
> > v3 changes:
> >   - added some acks
> >   - some patches got merged
> >   - added missing zalloc include [John Garry]
> >   - added ids array outside the egroup object [Ian]
> >   - removed wrong m->has_constraint assignment [Ian]
> >   - renamed 'list' to 'metric_list' [Ian]
> >   - fixed group metric and added test for it [Paul A. Clarke]
> >   - fixed memory leak [Arnaldo]
> >   - using lowercase keys for metrics in hashmap, because jevents
> >     converts metric_expr to lowercase
> > 
> > Also available in here:
> >   git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
> >   perf/metric
> 
> These changes seem to be mostly working for me.
> 
> I attempted to exploit the new capability in the metrics definitions in
> tools/perf/pmu-events/arch/powerpc/power9/metrics.json.  Those changes
> are included below.
> 
> The one problem I found is with the "cpi_breakdown" metric group, as it
> no longer works:
> ```
> # perf stat --metrics cpi_breakdown ./command
> Cannot find metric or group `cpi_breakdown'
> ```
> 
> "cpi_breakdown" does show up in `perf list --metricgroup`, and all of the
> (95!) metrics listed in that group are usable, so it's not obvious whether
> my changes have a problem, or merely provoke one.

I underestimated the recursion depth setup for groups,
your change is working for me with following change:

-#define RECURSION_ID_MAX 100
+#define RECURSION_ID_MAX 1000

jirka

Reply via email to