perf script: Don't disable use_callchain if input is pipe
authorHe Kuang <hekuang@huawei.com>
Thu, 4 Aug 2016 11:25:43 +0000 (11:25 +0000)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 15 Aug 2016 16:23:49 +0000 (13:23 -0300)
commit71ac899b5ed7edfd8fa2a4e075194380b1de2d7f
treeaa84f252b799a8715cabb36551dea97db1509927
parent88ded4d8d94a550624e1827478e13fecf97a7b0a
perf script: Don't disable use_callchain if input is pipe

Because perf data from pipe do not have a header with evsel attr, we
should not check that and disable symbol_conf.use_callchain. Otherwise,
perf script won't show callchains even if the data stream contains
callchain.

Before:
  $ perf record -g -o - uname |perf script
  Linux
  [ perf record: Woken up 1 times to write data ]
  [ perf record: Captured and wrote 0.000 MB - ]
  uname  1828 182630.186578:  250000 cpu-clock:  ..b9499 setup_arg_pages
  uname  1828 182630.186850:  250000 cpu-clock:  ..83b20 ___might_sleep
  uname  1828 182630.187153:  250000 cpu-clock:  ..4b6be file_map_prot_ch
  ...

After:
  $ perf record -g -o - uname |perf script
  Linux
  [ perf record: Woken up 1 times to write data ]
  [ perf record: Captured and wrote 0.000 MB - ]
  uname  1833 182675.927099:     250000 cpu-clock:
                  ba5520 _raw_spin_lock+0xfe200040 ([kernel.kallsyms])
                  389dd4 expand_downwards+0xfe200154 ([kernel.kallsyms])
                  389f34 expand_stack+0xfe200024 ([kernel.kallsyms])
                  3b957e setup_arg_pages+0xfe20019e ([kernel.kallsyms])
                  40c80f load_elf_binary+0xfe20042f ([kernel.kallsyms])
                  ...

Signed-off-by: He Kuang <hekuang@huawei.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1470309943-153909-2-git-send-email-hekuang@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-script.c