OSDN Git Service

perf tools: Reconstruct event with modifiers from perf_event_attr
authorArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 25 May 2012 19:38:11 +0000 (16:38 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 25 May 2012 19:38:11 +0000 (16:38 -0300)
commitc410431cefefd766266139ed56bca21668e4f9a7
treefe4ad29c08a3cf8fb1d8e754489fbe857e1dc79f
parent895d97663c83f8ed7a3386e912009155524fe7dd
perf tools: Reconstruct event with modifiers from perf_event_attr

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.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/evsel.c
tools/perf/util/evsel.h
tools/perf/util/parse-events.c