Re: [PATCH] perf stat: fix csv mode column output for non-cgroup events

From: Arnaldo Carvalho de Melo
Date: Tue Nov 27 2018 - 07:36:56 EST


Em Thu, Nov 22, 2018 at 10:08:35AM +0100, Jiri Olsa escreveu:
> On Thu, Nov 22, 2018 at 01:58:11AM -0200, Arnaldo Carvalho de Melo wrote:
> > Em Wed, Nov 07, 2018 at 02:50:45AM -0800, Stephane Eranian escreveu:
> > > When using the -x option, perf stat prints csv-style output
> > > with one event per line. For each event, it prints the count,
> > > the unit, the event name, the cgroup, and a bunch of other event
> > > specific fields (such as insn per cycles).
> > >
> > > When you use csv-style mode, you expect a normalized output where
> > > each event is printed with the same number of fields regardless of
> > > what it is so it can easily be imported into a spreadsheet or parsed.
> > > For instance, if an event does not have a unit, then print an empty field
> > > for it. Although this approach was implemented for the unit, it was not
> > > for the cgroup. When mixing cgroup and non-cgroup events, then non-cgroup
> > > events would not show an empty field, instead the next field was printed,
> > > make columns not line up correctly.
> > >
> > > This patch fixes the cgroup output issues by forcing an empty field
> > > for non-cgroup events as soon as one event has cgroup.
> >
> > Looks sane, that nr_cgroups global variable at some point has to go to
> > the evlist, but that is not introduced by this patch, Jiri, are you ok
> > with it as well?
>
> yep, looks good, sry I missed it
>
> Acked-by: Jiri Olsa <jolsa@xxxxxxxxxx>

Thanks, applied.

- Arnaldo