• Feng Tang's avatar
    perf scripts python: Add event_analyzing_sample.py as a sample for general event handling · 0076d546
    Feng Tang authored
    Currently only trace point events are supported in perf/python script,
    the first 3 patches of this serie add the support for all types of
    events. This script is just a simple sample to show how to gather the
    basic information of the events and analyze them.
    
    This script will create one object for each event sample and insert them
    into a table in a database, then leverage the simple SQL commands to
    sort/group them. User can modify or write their brand new functions
    according to their specific requirment.
    
    Here is the sample of how to use the script:
    
     $ perf record -a tree
     $ perf script -s process_event.py
    
    There is 100 records in gen_events table
    Statistics about the general events grouped by thread/symbol/dso:
    
                comm   number         histgram
    ==========================================
             swapper       56     ######
                tree       20     #####
                perf       10     ####
                sshd        8     ####
         kworker/7:2        4     ###
         ksoftirqd/7        1     #
     plugin-containe        1     #
    
                              symbol   number         histgram
    ==========================================================
               native_write_msr_safe       40     ######
                      __lock_acquire        8     ####
                 ftrace_graph_caller        4     ###
               prepare_ftrace_return        4     ###
                          intel_idle        3     ##
                  native_sched_clock        3     ##
                      Unknown_symbol        2     ##
                          do_softirq        2     ##
                        lock_release        2     ##
               lock_release_holdtime        2     ##
                   trace_graph_entry        2     ##
                            _IO_putc        1     #
                      __d_lookup_rcu        1     #
                          __do_fault        1     #
                          __schedule        1     #
                      _raw_spin_lock        1     #
                           delay_tsc        1     #
                 generic_exec_single        1     #
                    generic_fillattr        1     #
    
                                         dso   number         histgram
    ==================================================================
                           [kernel.kallsyms]       95     #######
                         /lib/libc-2.12.1.so        5     ###
    Signed-off-by: default avatarFeng Tang <feng.tang@intel.com>
    Cc: Andi Kleen <andi@firstfloor.org>
    Cc: David Ahern <dsahern@gmail.com>
    Cc: Ingo Molnar <mingo@elte.hu>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Robert Richter <robert.richter@amd.com>
    Cc: Stephane Eranian <eranian@google.com>
    Link: http://lkml.kernel.org/r/1344419875-21665-6-git-send-email-feng.tang@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    0076d546
event_analyzing_sample.py 7.34 KB