Re: [PATCH] perf/script: remove extraneous newline in perf_sample__fprintf_regs()

From: Stephane Eranian
Date: Wed Apr 29 2020 - 22:13:16 EST


On Wed, Apr 29, 2020 at 7:09 PM Andi Kleen <ak@xxxxxxxxxxxxxxx> wrote:
>
> > I was under the impression that perf script was generating one line
> > per sample. Otherwise, seems hard to parse.
>
> That's only true for simple cases. A lot of the extended output options
> have long generated multiple lines. And of course call stacks always did.
>
> > Could you give me the cmdline options of perf script that justify the newline.
>
> e.g. perf script -F iregs,uregs
>
But then it should only use the \n when needed.
It is a bit like perf stat printing cgroup as "" when not using cgroup
mode add a bunch of white spaces/tab at the end of the line for
nothing.

I also suggest that we improve perf stat/script output with an output
format that is easier to parse, such as JSON with name: value pairs.
that would avoid all these \n and
flaky parsing regexp or script I have seen, even internally.

> -Andi