diff options
author | Jin Yao <yao.jin@linux.intel.com> | 2021-01-25 02:27:50 +0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2021-02-03 19:10:43 +0300 |
commit | 4b799a9b772fc32e893408a22ae92fb96b5aaaa1 (patch) | |
tree | a48aabe9d78c8d71d6b9173dc2dde1c409c724db /tools/perf/builtin-script.c | |
parent | c69bf11ad3d30b6bf01cfa538ddff1a59467c734 (diff) | |
download | linux-4b799a9b772fc32e893408a22ae92fb96b5aaaa1.tar.xz |
perf script: Support DSO filter like in other perf tools
Other perf tool builtins already supported a DSO filter.
For example:
$ perf report --dsos a,b,c
which only considers symbols in these dsos.
Now the DSO filter is supported in 'perf script':
root@kbl-ppc:~# ./perf script --dsos "[kernel.kallsyms]"
perf 18123 [000] 6142863.075104: 1 cycles: ffffffff9ca77308 native_write_msr+0x8 ([kernel.kallsyms])
perf 18123 [000] 6142863.075107: 1 cycles: ffffffff9ca77308 native_write_msr+0x8 ([kernel.kallsyms])
perf 18123 [000] 6142863.075108: 10 cycles: ffffffff9ca77308 native_write_msr+0x8 ([kernel.kallsyms])
perf 18123 [000] 6142863.075109: 273 cycles: ffffffff9ca7730a native_write_msr+0xa ([kernel.kallsyms])
perf 18123 [000] 6142863.075110: 7684 cycles: ffffffff9ca3c9c0 native_sched_clock+0x50 ([kernel.kallsyms])
perf 18123 [000] 6142863.075112: 213017 cycles: ffffffff9d765a92 syscall_exit_to_user_mode+0x32 ([kernel.kallsyms])
perf 18123 [001] 6142863.075156: 1 cycles: ffffffff9ca77308 native_write_msr+0x8 ([kernel.kallsyms])
perf 18123 [001] 6142863.075158: 1 cycles: ffffffff9ca77308 native_write_msr+0x8 ([kernel.kallsyms])
perf 18123 [001] 6142863.075159: 17 cycles: ffffffff9ca77308 native_write_msr+0x8 ([kernel.kallsyms])
Committer testing:
$ perf script
ls 2364888 29303.010949: 1 cycles:u: ffffffffa4bbc6a9 [unknown] ([unknown])
ls 2364888 29303.010957: 1 cycles:u: ffffffffa429ef48 [unknown] ([unknown])
ls 2364888 29303.010961: 1 cycles:u: ffffffffa4260133 [unknown] ([unknown])
ls 2364888 29303.010964: 5 cycles:u: ffffffffa429efad [unknown] ([unknown])
ls 2364888 29303.010967: 41 cycles:u: ffffffffa42a4586 [unknown] ([unknown])
ls 2364888 29303.010972: 435 cycles:u: ffffffffa429efe0 [unknown] ([unknown])
ls 2364888 29303.010978: 5142 cycles:u: 7f9b95bc2abf __GI___tunables_init+0x11f (/usr/lib64/ld-2.32.so)
ls 2364888 29303.011006: 38551 cycles:u: ffffffffa4290f61 [unknown] ([unknown])
ls 2364888 29303.011486: 238234 cycles:u: 7f9b95bb7741 _dl_relocate_object+0xa71 (/usr/lib64/ld-2.32.so)
ls 2364888 29303.011937: 415870 cycles:u: 7f9b95a1c80e __strcoll_l+0xe (/usr/lib64/libc-2.32.so)
$
Before:
$ perf script --dsos /usr/lib64/libc-2.32.so |& head -5
Error: unknown option `dsos'
Usage: perf script [<options>]
or: perf script [<options>] record <script> [<record-options>] <command>
or: perf script [<options>] report <script> [script-args]
$
After:
$ perf script --dsos /usr/lib64/libc-2.32.so
ls 2364888 29303.011937: 415870 cycles:u: 7f9b95a1c80e __strcoll_l+0xe (/usr/lib64/libc-2.32.so)
$
Signed-off-by: Jin Yao <yao.jin@linux.intel.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jin Yao <yao.jin@intel.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lore.kernel.org/lkml/20210124232750.19170-2-yao.jin@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-script.c')
-rw-r--r-- | tools/perf/builtin-script.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c index 388762321cad..62bb0f1c35c3 100644 --- a/tools/perf/builtin-script.c +++ b/tools/perf/builtin-script.c @@ -3548,6 +3548,8 @@ int cmd_script(int argc, const char **argv) parse_output_fields), OPT_BOOLEAN('a', "all-cpus", &system_wide, "system-wide collection from all CPUs"), + OPT_STRING(0, "dsos", &symbol_conf.dso_list_str, "dso[,dso...]", + "only consider symbols in these DSOs"), OPT_STRING('S', "symbols", &symbol_conf.sym_list_str, "symbol[,symbol...]", "only consider these symbols"), OPT_CALLBACK_OPTARG(0, "insn-trace", &itrace_synth_opts, NULL, NULL, |