linux/tools/perf
Adrian Hunter 7ea95727af perf script: Set up output options for in-stream attributes
Attributes (struct perf_event_attr) are recorded separately in the
perf.data file.  perf script uses them to set up output options.
However attributes can also be in the event stream, for example when the
input is a pipe (i.e. live mode).  This patch makes perf script process
in-stream attributes in the same way as on-file attributes.

Here is an example:

Before this patch:

$ perf record uname | perf script
Linux
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.015 MB (null) (~655 samples) ]
:4220  4220 [-01] 2933367.838906: cycles:

:4220  4220 [-01] 2933367.838910: cycles:

:4220  4220 [-01] 2933367.838912: cycles:

:4220  4220 [-01] 2933367.838914: cycles:

:4220  4220 [-01] 2933367.838916: cycles:

:4220  4220 [-01] 2933367.838918: cycles:

uname  4220 [-01] 2933367.838938: cycles:

uname  4220 [-01] 2933367.839207: cycles:

After this patch:

$ perf record uname | perf script
Linux
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.015 MB (null) (~655 samples) ]
           :4582  4582 2933425.707724: cycles:  ffffffff81043ffa native_write_msr_safe ([kernel.kallsyms])
           :4582  4582 2933425.707728: cycles:  ffffffff81043ffa native_write_msr_safe ([kernel.kallsyms])
           :4582  4582 2933425.707730: cycles:  ffffffff81043ffa native_write_msr_safe ([kernel.kallsyms])
           :4582  4582 2933425.707732: cycles:  ffffffff81043ffa native_write_msr_safe ([kernel.kallsyms])
           :4582  4582 2933425.707734: cycles:  ffffffff81043ffa native_write_msr_safe ([kernel.kallsyms])
           :4582  4582 2933425.707736: cycles:  ffffffff81309a24 memcpy ([kernel.kallsyms])
           uname  4582 2933425.707760: cycles:  ffffffff8109c1c7 enqueue_task_fair ([kernel.kallsyms])
           uname  4582 2933425.707978: cycles:  ffffffff81308457 clear_page_c ([kernel.kallsyms])

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1383313899-15987-3-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-11-04 12:19:26 -03:00
..
arch tools/perf: Standardize feature support define names to: HAVE_{FEATURE}_SUPPORT 2013-10-09 08:48:28 +02:00
bench perf bench: Fix two warnings 2013-11-01 10:41:54 -03:00
config perf tools: Fix non-debug build 2013-10-23 11:07:14 -03:00
Documentation Merge branch 'perf/urgent' into perf/core 2013-10-29 11:23:32 +01:00
python perf python: Remove duplicate TID bit from mask 2013-08-07 17:35:25 -03:00
scripts perf script: Fix broken include in Context.xs 2013-07-10 13:47:00 -03:00
tests perf tools: Add time argument on COMM setting 2013-11-04 11:57:06 -03:00
ui perf tools: Use an accessor to read thread comm 2013-11-04 11:50:28 -03:00
util perf evsel: Add a debug print if perf_event_open fails 2013-11-04 12:18:17 -03:00
.gitignore perf tools: Ignore 'perf timechart' output file 2013-10-11 12:17:37 -03:00
bash_completion perf completion: Use more comp words 2013-10-09 11:12:31 -03:00
builtin-annotate.c perf tools: Show progress on histogram collapsing 2013-10-23 15:48:24 -03:00
builtin-bench.c perf bench: Change the procps visible command-name of invididual benchmark tests plus cleanups 2013-10-23 09:57:34 -03:00
builtin-buildid-cache.c perf tools: Add data object to handle perf data file 2013-10-21 17:33:24 -03:00
builtin-buildid-list.c perf session: Separating data file properties from session 2013-10-21 17:33:25 -03:00
builtin-diff.c perf tools: Show progress on histogram collapsing 2013-10-23 15:48:24 -03:00
builtin-evlist.c perf tools: Add data object to handle perf data file 2013-10-21 17:33:24 -03:00
builtin-help.c perf help: Fix --help for builtins 2012-10-22 12:35:49 -02:00
builtin-inject.c perf inject: Do not repipe attributes to a perf.data file 2013-10-23 10:58:03 -03:00
builtin-kmem.c perf tools: Use an accessor to read thread comm 2013-11-04 11:50:28 -03:00
builtin-kvm.c Merge branch 'perf/urgent' into perf/core 2013-10-29 11:23:32 +01:00
builtin-list.c perf list: List kernel supplied event aliases 2013-07-12 13:53:53 -03:00
builtin-lock.c perf tools: Use an accessor to read thread comm 2013-11-04 11:50:28 -03:00
builtin-mem.c perf tools: Add data object to handle perf data file 2013-10-21 17:33:24 -03:00
builtin-probe.c tools/perf: Standardize feature support define names to: HAVE_{FEATURE}_SUPPORT 2013-10-09 08:48:28 +02:00
builtin-record.c Merge branch 'perf/urgent' into perf/core 2013-10-29 11:23:32 +01:00
builtin-report.c perf tools: Show progress on histogram collapsing 2013-10-23 15:48:24 -03:00
builtin-sched.c perf tools: Use an accessor to read thread comm 2013-11-04 11:50:28 -03:00
builtin-script.c perf script: Set up output options for in-stream attributes 2013-11-04 12:19:26 -03:00
builtin-stat.c perf stat: Add units to nanosec-based counters 2013-10-11 12:17:46 -03:00
builtin-timechart.c perf tools: Add data object to handle perf data file 2013-10-21 17:33:24 -03:00
builtin-top.c perf tools: Add time argument on COMM setting 2013-11-04 11:57:06 -03:00
builtin-trace.c perf tools: Add new COMM infrastructure 2013-11-04 12:13:53 -03:00
builtin.h perf tools: Add new mem command for memory access profiling 2013-04-01 12:21:44 -03:00
command-list.txt perf tools: Add new mem command for memory access profiling 2013-04-01 12:21:44 -03:00
CREDITS
design.txt perf tools: Update ioctl documentation for PERF_IOC_FLAG_GROUP 2012-05-31 11:38:42 -03:00
Makefile tools/perf/build: Pass through DEBUG parameter 2013-10-14 10:29:07 -03:00
Makefile.perf perf tools: Add new COMM infrastructure 2013-11-04 12:13:53 -03:00
MANIFEST perf tools: Introduce tools/lib/lk library 2013-03-15 13:06:00 -03:00
perf-archive.sh perf archive: Make 'f' the last parameter for tar 2012-09-17 13:10:42 -03:00
perf.c perf trace: Add 'trace' alias to 'perf trace' 2013-10-11 12:17:10 -03:00
perf.h perf tools: Add data object to handle perf data file 2013-10-21 17:33:24 -03:00