aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Vagin <avagin@openvz.org>2012-08-07 08:56:05 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-10-26 09:22:25 -0400
commit54a3cf59b53b3f01989a28344ecf4cb68217a6f6 (patch)
treed5bb089080e23701b5f6af98c5c9ce74d9df85ca
parent26a031e136f4f8dc82c64df48cca0eb3b5d3eb4f (diff)
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>
-rw-r--r--tools/perf/builtin-inject.c11
-rw-r--r--tools/perf/util/build-id.c10
-rw-r--r--tools/perf/util/build-id.h4
3 files changed, 17 insertions, 8 deletions
diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c
index a4a307258fa3..84ad6abe4258 100644
--- a/tools/perf/builtin-inject.c
+++ b/tools/perf/builtin-inject.c
@@ -14,6 +14,7 @@
14#include "util/session.h" 14#include "util/session.h"
15#include "util/tool.h" 15#include "util/tool.h"
16#include "util/debug.h" 16#include "util/debug.h"
17#include "util/build-id.h"
17 18
18#include "util/parse-options.h" 19#include "util/parse-options.h"
19 20
@@ -116,6 +117,8 @@ static int perf_event__repipe_sample(struct perf_tool *tool,
116 return f(tool, event, sample, evsel, machine); 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 return perf_event__repipe_synth(tool, event, machine); 122 return perf_event__repipe_synth(tool, event, machine);
120} 123}
121 124
@@ -310,6 +313,7 @@ found:
310 sample_sw.time = sample->time; 313 sample_sw.time = sample->time;
311 perf_event__synthesize_sample(event_sw, evsel->attr.sample_type, 314 perf_event__synthesize_sample(event_sw, evsel->attr.sample_type,
312 &sample_sw, false); 315 &sample_sw, false);
316 build_id__mark_dso_hit(tool, event_sw, &sample_sw, evsel, machine);
313 return perf_event__repipe(tool, event_sw, &sample_sw, machine); 317 return perf_event__repipe(tool, event_sw, &sample_sw, machine);
314} 318}
315 319
@@ -342,8 +346,7 @@ static int __cmd_inject(struct perf_inject *inject)
342 346
343 signal(SIGINT, sig_handler); 347 signal(SIGINT, sig_handler);
344 348
345 if (inject->build_ids) { 349 if (inject->build_ids || inject->sched_stat) {
346 inject->tool.sample = perf_event__inject_buildid;
347 inject->tool.mmap = perf_event__repipe_mmap; 350 inject->tool.mmap = perf_event__repipe_mmap;
348 inject->tool.fork = perf_event__repipe_fork; 351 inject->tool.fork = perf_event__repipe_fork;
349 inject->tool.tracing_data = perf_event__repipe_tracing_data; 352 inject->tool.tracing_data = perf_event__repipe_tracing_data;
@@ -353,7 +356,9 @@ static int __cmd_inject(struct perf_inject *inject)
353 if (session == NULL) 356 if (session == NULL)
354 return -ENOMEM; 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 struct perf_evsel *evsel; 362 struct perf_evsel *evsel;
358 363
359 inject->tool.ordered_samples = true; 364 inject->tool.ordered_samples = true;
diff --git a/tools/perf/util/build-id.c b/tools/perf/util/build-id.c
index 6a6399955ef2..94ca117b8d6e 100644
--- a/tools/perf/util/build-id.c
+++ b/tools/perf/util/build-id.c
@@ -16,11 +16,11 @@
16#include "session.h" 16#include "session.h"
17#include "tool.h" 17#include "tool.h"
18 18
19static int build_id__mark_dso_hit(struct perf_tool *tool __maybe_unused, 19int build_id__mark_dso_hit(struct perf_tool *tool __maybe_unused,
20 union perf_event *event, 20 union perf_event *event,
21 struct perf_sample *sample __maybe_unused, 21 struct perf_sample *sample __maybe_unused,
22 struct perf_evsel *evsel __maybe_unused, 22 struct perf_evsel *evsel __maybe_unused,
23 struct machine *machine) 23 struct machine *machine)
24{ 24{
25 struct addr_location al; 25 struct addr_location al;
26 u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK; 26 u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK;
diff --git a/tools/perf/util/build-id.h b/tools/perf/util/build-id.h
index a993ba87d996..45c500bd5b9f 100644
--- a/tools/perf/util/build-id.h
+++ b/tools/perf/util/build-id.h
@@ -7,4 +7,8 @@ extern struct perf_tool build_id__mark_dso_hit_ops;
7 7
8char *dso__build_id_filename(struct dso *self, char *bf, size_t size); 8char *dso__build_id_filename(struct dso *self, char *bf, size_t size);
9 9
10int build_id__mark_dso_hit(struct perf_tool *tool, union perf_event *event,
11 struct perf_sample *sample, struct perf_evsel *evsel,
12 struct machine *machine);
13
10#endif 14#endif