linux-stable/tools/perf
David Ahern 1424dc9680 perf script: Add support for H/W and S/W events
Custom fields set for each type by prepending field argument with type.
For file with multiple event types (e.g., trace and S/W) display of an
event type suppressed by setting output fields to "".

e.g.,
perf record -ga -e sched:sched_switch -e cpu-clock -c 10000000 -R -- sleep 1
perf script

openssl 11496 [000]  9711.807107: cpu-clock-msecs:
        ffffffff810c22dc arch_local_irq_restore ([kernel.kallsyms])
        ffffffff810c518c __alloc_pages_nodemask ([kernel.kallsyms])
        ffffffff810297b2 pte_alloc_one ([kernel.kallsyms])
        ffffffff810d8b98 __pte_alloc ([kernel.kallsyms])
        ffffffff810daf07 handle_mm_fault ([kernel.kallsyms])
        ffffffff8138763a do_page_fault ([kernel.kallsyms])
        ffffffff81384a65 page_fault ([kernel.kallsyms])
            7f6130507d70 asn1_check_tlen (/lib64/libcrypto.so.1.0.0c)
                       0  ()

         openssl 11496 [000]  9711.808042: sched_switch: prev_comm=openssl ...
     kworker/0:0     4 [000]  9711.808067: sched_switch: prev_comm=kworker/...
         swapper     0 [001]  9711.808090: sched_switch: prev_comm=kworker/...
            sshd 11451 [001]  9711.808185: sched_switch: prev_comm=sshd pre...
swapper     0 [001]  9711.816155: cpu-clock-msecs:
        ffffffff81023609 native_safe_halt ([kernel.kallsyms])
        ffffffff8100132a cpu_idle ([kernel.kallsyms])
        ffffffff8137cf9b start_secondary ([kernel.kallsyms])

openssl 11496 [000]  9711.817104: cpu-clock-msecs:
            7f61304ad723 AES_cbc_encrypt (/lib64/libcrypto.so.1.0.0c)
            7fff3402f950  ()
        12f0debc9a785634  ()

swapper     0 [001]  9711.826155: cpu-clock-msecs:
        ffffffff81023609 native_safe_halt ([kernel.kallsyms])
        ffffffff8100132a cpu_idle ([kernel.kallsyms])
        ffffffff8137cf9b start_secondary ([kernel.kallsyms])

To suppress trace events within the file and use default output for S/W events:
perf script -f trace:

or to suppress S/W events and do default display for trace events:
perf script -f sw:

Custom field selections:
perf script -f sw:comm,tid,time -f trace:time,trace

         openssl 11496  9711.797162:
         swapper     0  9711.807071:
         openssl 11496  9711.807107:
 9711.808042: prev_comm=openssl prev_pid=11496 prev_prio=120 prev_state=R ...
 9711.808067: prev_comm=kworker/0:0 prev_pid=4 prev_prio=120 prev_state=S ...
 9711.808090: prev_comm=kworker/0:0 prev_pid=0 prev_prio=120 prev_state=R ...
 9711.808185: prev_comm=sshd prev_pid=11451 prev_prio=120 prev_state=S ==>...
         swapper     0  9711.816155:
         openssl 11496  9711.817104:
         swapper     0  9711.826155:

Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
LKML-Reference: <1299734608-5223-7-git-send-email-daahern@cisco.com>
Signed-off-by: David Ahern <daahern@cisco.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2011-03-14 17:07:20 -03:00
..
arch [S390] perf: add DWARF register lookup for s390 2011-01-05 12:47:31 +01:00
bench perf tool: Fix gcc 4.6.0 issues 2011-02-07 12:41:41 -02:00
Documentation perf script: Add support for H/W and S/W events 2011-03-14 17:07:20 -03:00
python perf evlist: Store pointer to the cpu and thread maps 2011-01-31 12:40:52 -02:00
scripts perf script: Finish the rename from trace to script 2010-12-25 11:29:02 -02:00
util perf script: Add support for H/W and S/W events 2011-03-14 17:07:20 -03:00
.gitignore perf tools: Makefile: Remove various and sundry cruft 2011-02-18 07:43:06 -02:00
builtin-annotate.c perf tools: Improve support for sessions with multiple events 2011-03-06 13:13:40 -03:00
builtin-bench.c perf options: Type check all the remaining OPT_ variants 2010-05-17 16:22:41 -03:00
builtin-buildid-cache.c perf buildid: add perfconfig option to specify buildid cache dir 2010-06-05 09:34:04 -03:00
builtin-buildid-list.c Merge commit 'v2.6.37-rc8' into perf/core 2011-01-04 08:08:54 +01:00
builtin-diff.c perf tools: Kill event_t typedef, use 'union perf_event' instead 2011-01-29 16:25:37 -02:00
builtin-help.c perf options: Type check all the remaining OPT_ variants 2010-05-17 16:22:41 -03:00
builtin-inject.c perf tools: Kill event_t typedef, use 'union perf_event' instead 2011-01-29 16:25:37 -02:00
builtin-kmem.c perf tools: Kill event_t typedef, use 'union perf_event' instead 2011-01-29 16:25:37 -02:00
builtin-kvm.c perf options: Type check all the remaining OPT_ variants 2010-05-17 16:22:41 -03:00
builtin-list.c perf list: Allow filtering list of events 2011-02-17 15:38:58 -02:00
builtin-lock.c perf lock: Document valid sort keys 2011-02-23 07:29:33 -03:00
builtin-probe.c perf probe: Use %td for pointer arithmetic result 2011-01-31 19:45:38 -02:00
builtin-record.c perf session: Use evlist/evsel for managing perf.data attributes 2011-03-10 11:15:54 -03:00
builtin-report.c perf session: Use evlist/evsel for managing perf.data attributes 2011-03-10 11:15:54 -03:00
builtin-sched.c perf tool: Fix gcc 4.6.0 issues 2011-02-07 12:41:41 -02:00
builtin-script.c perf script: Add support for H/W and S/W events 2011-03-14 17:07:20 -03:00
builtin-stat.c perf stat: Provide support for filters 2011-03-14 13:37:52 -03:00
builtin-test.c perf evlist: Store pointer to the cpu and thread maps 2011-01-31 12:40:52 -02:00
builtin-timechart.c Merge branch 'perf/urgent' into perf/core 2011-03-04 10:40:25 +01:00
builtin-top.c perf symbol: Move sym_entry->skip to symbol->ignore 2011-03-11 13:36:01 -03:00
builtin.h perf: Rename 'perf trace' to 'perf script' 2010-11-16 19:37:44 +01:00
command-list.txt Merge branch 'perf/rename' into perf/core 2010-12-01 09:22:19 +01:00
CREDITS perf_counter tools: Add CREDITS file for Git contributors 2009-06-24 19:54:29 +02:00
design.txt perf: Fix few typos + cosmetics 2010-01-13 17:39:44 +01:00
feature-tests.mak perf tools: Remove hardcoded include paths for elfutils 2010-11-19 16:38:04 -02:00
Makefile perf tools: Makefile: Remove various and sundry cruft 2011-02-18 07:43:06 -02:00
MANIFEST perf packaging: add memcpy to perf MANIFEST 2010-11-30 23:00:10 -02:00
perf-archive.sh perf buildid: add perfconfig option to specify buildid cache dir 2010-06-05 09:34:04 -03:00
perf.c perf evsel: Fix order of event list deletion 2011-01-11 12:51:03 -02:00
perf.h perf record: Move perf_mmap__write_tail to perf.h 2011-01-22 19:56:29 -02:00