• David Ahern's avatar
    perf script: Add support for H/W and S/W events · 1424dc96
    David Ahern authored
    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: default avatarFrederic 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: default avatarDavid Ahern <daahern@cisco.com>
    Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    1424dc96
parse-events.h 1.12 KB