• Arnaldo Carvalho de Melo's avatar
    perf tools: Reconstruct event with modifiers from perf_event_attr · c410431c
    Arnaldo Carvalho de Melo authored
    The modifiers:
    
      k		kernel space
      u		user space
      h		hypervisor
      G		guest
      H		host
      p, pp, ppp    precision level (PEBS)
    
    that can be suffixed to an event were lost when tools used event_name()
    to reconstruct them from the perf_event_attr entries in a perf.data
    file.
    
    Fix it by following the defaults used for these modifiers in the current
    codebase, so:
    
     $ perf record -e instructions:u usleep 1 2> /dev/null
     $ perf evlist
     instructions:u
     $ perf record -e cycles:k usleep 1 2> /dev/null
     $ perf evlist
     cycles:k
     $ perf record -e cycles:kh usleep 1 2> /dev/null
     $ perf evlist
     cycles:kh
     $ perf record -e cache-misses:G usleep 1 2> /dev/null
     $ perf evlist
     cache-misses:G
     $ perf record -e cycles:ppk usleep 1 2> /dev/null
     $ perf evlist
     cycles:kpp
     $
    
    Also works with 'top', 'report', etc.
    
    More work needed to cover tracepoints and software events while not
    dragging lots of baggage to the python binding, this is a minimal fix
    for v3.5.
    
    Cc: David Ahern <dsahern@gmail.com>
    Cc: Frederic Weisbecker <fweisbec@gmail.com>
    Cc: Mike Galbraith <efault@gmx.de>
    Cc: Namhyung Kim <namhyung@gmail.com>
    Cc: Paul Mackerras <paulus@samba.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Stephane Eranian <eranian@google.com>
    Link: http://lkml.kernel.org/n/tip-4hl5glle0hxlklw4usva1mkt@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    c410431c
evsel.h 4.73 KB