On Wed, Jul 22, 2020 at 08:11:58PM +0200, Jiri Olsa wrote:
> 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

I just saw some odd behavior:
```
# perf stat --metrics cpi_breakdown --metrics cpi_breakdown --metric-only ./cmd
WARNING: grouped events cpus do not match, disabling group:
  anon group { raw 0x2d018 }                                                    
     
  anon group { raw 0x2d018 }   
  anon group { raw 0x2d018 }                                                    
                                                                                
                                                  
  anon group { raw 0x2d018 }                                               
  anon group { raw 0x1006a }                                                    
                                                                                
                                                  
  anon group { raw 0x400fa }                                                    
                                                                                
                                                  
  anon group { raw 0x400fa }                                               
  anon group { raw 0x400fa }                                               
  anon group { raw 0x400fa }                                               
perf: util/evsel.c:1452: get_group_fd: Assertion `!(!leader->core.fd)' failed.  
                                                           
Aborted (core dumped)
```

It happened both with and without my changes on binaries which were built
yesterday.  Three or four times in a row.

Oddly, it went away without any action on my part. Same commands a minute or so
later. I haven't seen this before.  I can't reproduce it now.  :-/

PC

Reply via email to