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

From: Jiri Olsa
Date: Tue May 02 2017 - 02:41:56 EST


On Mon, May 01, 2017 at 12:47:46PM -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 pid,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])


I haven't checked deeply yet, but I'm getting different pids
with the new syntax, perhaps some mixing with tids column?

0 [002] 42615.004240: 2172 cycles: ffffffff86060c66 native_write_msr ([kernel.kallsyms])
0 [002] 42615.004242: 19857 cycles: ffffffff860abee0 irq_exit ([kernel.kallsyms])
0 [002] 42615.004250: 412618 cycles: ffffffff860d1429 ttwu_do_wakeup ([kernel.kallsyms])
- 1798 [001] 42615.008219: 46557 cycles: ffffffff860dc718 update_blocked_averages ([kernel.kallsyms])
- 1798 [001] 42615.008239: 46557 cycles: 7f313dff0684 [unknown] (/usr/lib64/firefox/libxul.so)
- 1798 [001] 42615.008258: 112387 cycles: 7f313e32c71a [unknown] (/usr/lib64/firefox/libxul.so)
+ 1861 [001] 42615.008219: 46557 cycles: ffffffff860dc718 update_blocked_averages ([kernel.kallsyms])
+ 1861 [001] 42615.008239: 46557 cycles: 7f313dff0684 [unknown] (/usr/lib64/firefox/libxul.so)
+ 1861 [001] 42615.008258: 112387 cycles: 7f313e32c71a [unknown] (/usr/lib64/firefox/libxul.so)
1687 [002] 42615.008268: 1711528 cycles: ffffffffc01e74c7 i915_gem_set_domain_ioctl ([i915])
- 1798 [001] 42615.008303: 281652 cycles: ffffffff860dc169 account_entity_dequeue ([kernel.kallsyms])
+ 1861 [001] 42615.008303: 281652 cycles: ffffffff860dc169 account_entity_dequeue ([kernel.kallsyms])
1798 [001] 42615.008440: 442473 cycles: 7f3147c6935b g_slice_free1 (/usr/lib64/libglib-2.0.so.0.5000.3)
- 1935 [001] 42615.009462: 487718 cycles: ffffffff860f25bc cpuacct_charge ([kernel.kallsyms])
- 1935 [002] 42615.009955: 1711528 cycles: 7fa2a2ac748f [unknown] (/usr/lib64/firefox/libmozavcodec.so)
- 1935 [001] 42615.009989: 441676 cycles: 559627e901da [unknown] (/usr/lib64/firefox/firefox)
- 1935 [000] 42615.010233: 79099 cycles: 7fa2c2a11fa9 [unknown] (/usr/lib64/firefox/libxul.so)
+24128 [001] 42615.009462: 487718 cycles: ffffffff860f25bc cpuacct_charge ([kernel.kallsyms])
+24182 [002] 42615.009955: 1711528 cycles: 7fa2a2ac748f [unknown] (/usr/lib64/firefox/libmozavcodec.so)
+24181 [001] 42615.009989: 441676 cycles: 559627e901da [unknown] (/usr/lib64/firefox/firefox)
+24112 [000] 42615.010233: 79099 cycles: 7fa2c2a11fa9 [unknown] (/usr/lib64/firefox/libxul.so)

thanks,
jirka