Re: [PATCH] perf, tools, script: Allow adding and removing fields

From: Jiri Olsa
Date: Tue May 09 2017 - 08:18:37 EST


On Mon, May 08, 2017 at 09:21:34AM -0700, Andi Kleen wrote:
> From: Andi Kleen <ak@xxxxxxxxxxxxxxx>
>
> With perf script it is common that we just want to add or remove a field.
> Currently this requires figuring out the long list of default fields and
> specifying them first, and then adding/removing the new field.
>
> This patch adds a new + - syntax to merely add or remove fields,
> that allows more succint and clearer command lines
>
> For example to remove the comm field from PMU samples:
>
> Previously
>
> perf script -F tid,cpu,time,event,sym,ip,dso,period
> 0 [000] 504345.383126: 1 cycles: ffffffff90060c66 native_write_msr ([kernel.kallsyms])
>
> with the new syntax
>
> perf script -F -comm
> 0 [000] 504345.383126: 1 cycles: ffffffff90060c66 native_write_msr ([kernel.kallsyms])
>
> The new syntax cannot be mixed with normal overriding.

so the -F option for 'type:' does not have default set,
and it looks like the +- don't make sense there:

[jolsa@krava perf]$ ./perf script -F hw:+comm | head -3
ex
ex
ex


jirka