Re: [PATCH] perf stat: fix cvs output format

From: Arnaldo Carvalho de Melo
Date: Tue Mar 06 2018 - 12:30:14 EST


Em Tue, Mar 06, 2018 at 09:00:11AM -0800, Andi Kleen escreveu:
> On Mon, Mar 05, 2018 at 10:43:53PM -0800, Cong Wang wrote:
> > From: Ilya Pronin <ipronin@xxxxxxxxxxx>
> >
> > When printing stats in CSV mode, perf stat appends extra CSV
> > separators when counter is not supported:
> >
> > <not supported>,,L1-dcache-store-misses,mesos/bd442f34-2b4a-47df-b966-9b281f9f56fc,0,100.00,,,,
> >
> > which causes a failure of parsing fields. The numbers of separators
>
> Causes failure in what?
>
> > is fixed for each line, no matter supported or not supported.
>
> I don't think they're extra fields, there are cases where they can be filled out

My understanding was that at some place there is a if/else

if (supported counters)
fprintf_something with N fields, all filled in
else
fprintf_empty_fields with != N fields

So I think this is not about using things like 'a,b,,,,,,' but about
using different number of commas (fields) for supported/unsupported
counters, no?

- Arnaldo

> for variance, metricvalue, unit. And other code in perf too uses empty
> fields when something is not available.
>
> - optional usec time stamp in fractions of second (with -I xxx)
> - optional CPU, core, or socket identifier
> - optional number of logical CPUs aggregated
> - counter value
> - unit of the counter value or empty
> - event name
> - run time of counter
> - percentage of measurement time the counter was running
> - optional variance if multiple values are collected with -r
> - optional metric value
> - optional unit of metric
>
>
> -Andi