linux/tools/perf/util
Arnaldo Carvalho de Melo 8d06367fa7 perf symbols: Use the buildids if present
With this change 'perf record' will intercept PERF_RECORD_MMAP
calls, creating a linked list of DSOs, then when the session
finishes, it will traverse this list and read the buildids,
stashing them at the end of the file and will set up a new
feature bit in the header bitmask.

'perf report' will then notice this feature and populate the
'dsos' list and set the build ids.

When reading the symtabs it will refuse to load from a file that
doesn't have the same build id. This improves the
reliability of the profiler output, as symbols and profiling
data is more guaranteed to match.

Example:

 [root@doppio ~]# perf report | head
 /home/acme/bin/perf with build id b1ea544ac3746e7538972548a09aadecc5753868 not found, continuing without symbols
  # Samples: 2621434559
  #
  # Overhead          Command                  Shared Object  Symbol
  # ........  ...............  .............................  ......
  #
       7.91%             init  [kernel]        [k] read_hpet
       7.64%             init  [kernel]        [k] mwait_idle_with_hints
       7.60%          swapper  [kernel]        [k] read_hpet
       7.60%          swapper  [kernel]        [k] mwait_idle_with_hints
       3.65%             init  [kernel]        [k] 0xffffffffa02339d9
[root@doppio ~]#

In this case the 'perf' binary was an older one, vanished,
so its symbols probably wouldn't match or would cause subtly
different (and misleading) output.

Next patches will support the kernel as well, reading the build
id notes for it and the modules from /sys.

Another patch should also introduce a new plumbing command:

'perf list-buildids'

that will then be used in porcelain that is distro specific to
fetch -debuginfo packages where such buildids are present. This
will in turn allow for one to run 'perf record' in one machine
and 'perf report' in another.

Future work on having the buildid sent directly from the kernel
in the PERF_RECORD_MMAP event is needed to close races, as the
DSO can be changed during a 'perf record' session, but this
patch at least helps with non-corner cases and current/older
kernels.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Frank Ch. Eigler <fche@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jason Baron <jbaron@redhat.com>
Cc: Jim Keniston <jkenisto@us.ibm.com>
Cc: K. Prasad <prasad@linux.vnet.ibm.com>
Cc: Masami Hiramatsu <mhiramat@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Roland McGrath <roland@redhat.com>
Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
LKML-Reference: <1257367843-26224-1-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2009-11-08 10:44:36 +01:00
..
include perf tools: Unify debug messages mechanisms 2009-10-23 08:22:47 +02:00
abspath.c
alias.c
cache.h
callchain.c perf tools: Unify debug messages mechanisms 2009-10-23 08:22:47 +02:00
callchain.h
color.c
color.h
config.c
ctype.c
data_map.c perf symbols: Use the buildids if present 2009-11-08 10:44:36 +01:00
data_map.h
debug.c perf tools: Unify debug messages mechanisms 2009-10-23 08:22:47 +02:00
debug.h perf tools: Unify debug messages mechanisms 2009-10-23 08:22:47 +02:00
environment.c
event.c perf tools: Generalize event synthesizing routines 2009-10-27 13:51:53 +01:00
event.h perf symbols: Use the buildids if present 2009-11-08 10:44:36 +01:00
exec_cmd.c
exec_cmd.h
generate-cmdlist.sh
header.c perf symbols: Use the buildids if present 2009-11-08 10:44:36 +01:00
header.h perf symbols: Use the buildids if present 2009-11-08 10:44:36 +01:00
help.c
help.h
hist.c
hist.h
levenshtein.c
levenshtein.h
map.c perf symbols: Use the buildids if present 2009-11-08 10:44:36 +01:00
pager.c
parse-events.c perf tools: Output 'perf list' to stdout not stderr 2009-10-27 14:52:32 +01:00
parse-events.h perf trace: Add filter Suppport 2009-10-15 11:35:23 +02:00
parse-options.c
parse-options.h
path.c
PERF-VERSION-GEN perf tools: Bump version to 0.0.2 2009-10-16 10:34:28 +02:00
quote.c
quote.h
run-command.c
run-command.h
sigchain.c
sigchain.h
sort.c perf tools: Bind callchains to the first sort dimension column 2009-10-23 07:55:18 +02:00
sort.h perf tools: Bind callchains to the first sort dimension column 2009-10-23 07:55:18 +02:00
strbuf.c
strbuf.h
string.c
string.h
strlist.c
strlist.h
svghelper.c perf timechart: Improve the visual appearance of scheduler delays 2009-10-20 03:39:21 +02:00
svghelper.h
symbol.c perf symbols: Use the buildids if present 2009-11-08 10:44:36 +01:00
symbol.h perf symbols: Use the buildids if present 2009-11-08 10:44:36 +01:00
thread.c perf tools: Unify debug messages mechanisms 2009-10-23 08:22:47 +02:00
thread.h perf tools: Bind callchains to the first sort dimension column 2009-10-23 07:55:18 +02:00
trace-event-info.c
trace-event-parse.c perf tools: Use strsep() over strtok_r() for parsing single line 2009-10-21 13:39:57 +02:00
trace-event-read.c
trace-event.h perf tools: Add latency format to trace output 2009-10-15 10:42:39 +02:00
types.h
usage.c
util.h
values.c
values.h
wrapper.c