Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf record: Add record.build-id config option

Post processing at 'perf record' takes a long time on big machines.

What it does is to find the build-id of binaries found in the event
stream, so that it can make sure, at 'report' time, that the symtabs (be
it ELF, kallsyms, etc) being used to resolve symbols are the ones
matching the binaries found at 'record' time.

Sometimes we just want to skip this processing of events at the end of
the session to get quicker results, making sure the binaries haven't
changed from 'record' to 'report' time.

Add a new config option to control this behavior.

The record.build-id config variable can have one of the following
values:

- cache: post-process data and save/update the binaries into the
build-id cache (in ~/.debug). This is the default.
- no-cache: post-process the data but not update the build-id cache.
Same effect as using the -N option.
- skip: skip post-processing and do not update the cache.
Same effect as using the -B option.

Reported-and-Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Taeung Song <treeze.taeung@gmail.com>
Link: http://lkml.kernel.org/r/1450144196-22957-1-git-send-email-namhyung@kernel.org
[ Added some more text to the documentation ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Namhyung Kim and committed by
Arnaldo Carvalho de Melo
7a29c087 7efe0e03

+26 -1
+13 -1
tools/perf/Documentation/perf-record.txt
··· 207 207 In per-thread mode with inheritance mode on (default), samples are captured only when 208 208 the thread executes on the designated CPUs. Default is to monitor all CPUs. 209 209 210 + -B:: 211 + --no-buildid:: 212 + Do not save the build ids of binaries in the perf.data files. This skips 213 + post processing after recording, which sometimes makes the final step in 214 + the recording process to take a long time, as it needs to process all 215 + events looking for mmap records. The downside is that it can misresolve 216 + symbols if the workload binaries used when recording get locally rebuilt 217 + or upgraded, because the only key available in this case is the 218 + pathname. You can also set the "record.build-id" config variable to 219 + 'skip to have this behaviour permanently. 220 + 210 221 -N:: 211 222 --no-buildid-cache:: 212 223 Do not update the buildid cache. This saves some overhead in situations 213 224 where the information in the perf.data file (which includes buildids) 214 - is sufficient. 225 + is sufficient. You can also set the "record.build-id" config variable to 226 + 'no-cache' to have the same effect. 215 227 216 228 -G name,...:: 217 229 --cgroup name,...::
+13
tools/perf/builtin-record.c
··· 837 837 838 838 static int perf_record_config(const char *var, const char *value, void *cb) 839 839 { 840 + struct record *rec = cb; 841 + 842 + if (!strcmp(var, "record.build-id")) { 843 + if (!strcmp(value, "cache")) 844 + rec->no_buildid_cache = false; 845 + else if (!strcmp(value, "no-cache")) 846 + rec->no_buildid_cache = true; 847 + else if (!strcmp(value, "skip")) 848 + rec->no_buildid = true; 849 + else 850 + return -1; 851 + return 0; 852 + } 840 853 if (!strcmp(var, "record.call-graph")) 841 854 var = "call-graph.record-mode"; /* fall-through */ 842 855