• Jiri Olsa's avatar
    perf script: Add python support for stat events · aef90263
    Jiri Olsa authored
    Add support to get stat events data in perf python scripts.
    
    The python script shall implement the following new interface to process
    stat data:
    
      def stat__<event_name>_[<modifier>](cpu, thread, time, val, ena, run):
    
        - is called for every stat event for given counter,
          if user monitors 'cycles,instructions:u" following
          callbacks should be defined:
    
          def stat__cycles(cpu, thread, time, val, ena, run):
          def stat__instructions_u(cpu, thread, time, val, ena, run):
    
      def stat__interval(time):
    
        - is called for every interval with its time,
          in non interval mode it's called after last
          stat event with total measured time in ns
    
    The rest of the current interface stays untouched..
    
    Please check example CPI metrics script in following patch
    with command line examples in changelogs.
    Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
    Tested-by: default avatarKan Liang <kan.liang@intel.com>
    Cc: David Ahern <dsahern@gmail.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
    Link: http://lkml.kernel.org/r/1452028152-26762-8-git-send-email-jolsa@kernel.org
    [ Rename 'time' parameters to 'tstamp', to fix the build in older distros ]
    Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    aef90263
trace-event-python.c 32.8 KB