Commit 54a3cf59b53b3f01989a28344ecf4cb68217a6f6
Committed by
Arnaldo Carvalho de Melo
1 parent
26a031e136
Exists in
master
and in
20 other branches
perf inject: Mark a dso if it's used
Otherwise they will be not written in an output file. Signed-off-by: Andrew Vagin <avagin@openvz.org> Cc: Ingo Molnar <mingo@redhat.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1344344165-369636-5-git-send-email-avagin@openvz.org [ committer note: Fixed up wrt changes made in the immediate previous patches ] Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Showing 3 changed files with 17 additions and 8 deletions Side-by-side Diff
tools/perf/builtin-inject.c
... | ... | @@ -14,6 +14,7 @@ |
14 | 14 | #include "util/session.h" |
15 | 15 | #include "util/tool.h" |
16 | 16 | #include "util/debug.h" |
17 | +#include "util/build-id.h" | |
17 | 18 | |
18 | 19 | #include "util/parse-options.h" |
19 | 20 | |
... | ... | @@ -116,6 +117,8 @@ |
116 | 117 | return f(tool, event, sample, evsel, machine); |
117 | 118 | } |
118 | 119 | |
120 | + build_id__mark_dso_hit(tool, event, sample, evsel, machine); | |
121 | + | |
119 | 122 | return perf_event__repipe_synth(tool, event, machine); |
120 | 123 | } |
121 | 124 | |
... | ... | @@ -310,6 +313,7 @@ |
310 | 313 | sample_sw.time = sample->time; |
311 | 314 | perf_event__synthesize_sample(event_sw, evsel->attr.sample_type, |
312 | 315 | &sample_sw, false); |
316 | + build_id__mark_dso_hit(tool, event_sw, &sample_sw, evsel, machine); | |
313 | 317 | return perf_event__repipe(tool, event_sw, &sample_sw, machine); |
314 | 318 | } |
315 | 319 | |
... | ... | @@ -342,8 +346,7 @@ |
342 | 346 | |
343 | 347 | signal(SIGINT, sig_handler); |
344 | 348 | |
345 | - if (inject->build_ids) { | |
346 | - inject->tool.sample = perf_event__inject_buildid; | |
349 | + if (inject->build_ids || inject->sched_stat) { | |
347 | 350 | inject->tool.mmap = perf_event__repipe_mmap; |
348 | 351 | inject->tool.fork = perf_event__repipe_fork; |
349 | 352 | inject->tool.tracing_data = perf_event__repipe_tracing_data; |
... | ... | @@ -353,7 +356,9 @@ |
353 | 356 | if (session == NULL) |
354 | 357 | return -ENOMEM; |
355 | 358 | |
356 | - if (inject->sched_stat) { | |
359 | + if (inject->build_ids) { | |
360 | + inject->tool.sample = perf_event__inject_buildid; | |
361 | + } else if (inject->sched_stat) { | |
357 | 362 | struct perf_evsel *evsel; |
358 | 363 | |
359 | 364 | inject->tool.ordered_samples = true; |
tools/perf/util/build-id.c
... | ... | @@ -16,11 +16,11 @@ |
16 | 16 | #include "session.h" |
17 | 17 | #include "tool.h" |
18 | 18 | |
19 | -static int build_id__mark_dso_hit(struct perf_tool *tool __maybe_unused, | |
20 | - union perf_event *event, | |
21 | - struct perf_sample *sample __maybe_unused, | |
22 | - struct perf_evsel *evsel __maybe_unused, | |
23 | - struct machine *machine) | |
19 | +int build_id__mark_dso_hit(struct perf_tool *tool __maybe_unused, | |
20 | + union perf_event *event, | |
21 | + struct perf_sample *sample __maybe_unused, | |
22 | + struct perf_evsel *evsel __maybe_unused, | |
23 | + struct machine *machine) | |
24 | 24 | { |
25 | 25 | struct addr_location al; |
26 | 26 | u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK; |
tools/perf/util/build-id.h