mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Vagin <avagin@openvz.org>
To: linux-kernel@vger.kernel.org
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Subject: [PATCH 3/3] perf: mark a dso if it's used
Date: Mon,  6 Aug 2012 14:01:59 +0400	[thread overview]
Message-ID: <1344247319-304069-4-git-send-email-avagin@openvz.org> (raw)
In-Reply-To: <1344247319-304069-1-git-send-email-avagin@openvz.org>

Otherwise they will be not written in an output file.

Signed-off-by: Andrew Vagin <avagin@openvz.org>
---
 tools/perf/builtin-inject.c |   11 +++++++++--
 tools/perf/util/build-id.c  |    2 +-
 tools/perf/util/build-id.h  |    5 +++++
 3 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c
index 247f41c..cb2fd77 100644
--- a/tools/perf/builtin-inject.c
+++ b/tools/perf/builtin-inject.c
@@ -14,6 +14,7 @@
 
 #include "util/parse-options.h"
 #include "util/trace-event.h"
+#include "util/build-id.h"
 
 
 static char		const *input_name	= "-";
@@ -281,13 +282,17 @@ static int perf_event__sched_stat(struct perf_tool *tool,
 
 		event_sw = &ent->event[0];
 		perf_session__parse_sample(session, event_sw, &sample_sw);
+
 		sample_sw.period = sample->period;
 		sample_sw.time = sample->time;
 		perf_session__synthesize_sample(session, event_sw, &sample_sw);
+
+		build_id__mark_dso_hit(tool, event_sw, &sample_sw, evsel, machine);
 		perf_event__repipe(tool, event_sw, &sample_sw, machine);
 		return 0;
 	}
 
+	build_id__mark_dso_hit(tool, event, sample, evsel, machine);
 	perf_event__repipe(tool, event, sample, machine);
 
 	return 0;
@@ -321,12 +326,14 @@ static int __cmd_inject(void)
 
 	signal(SIGINT, sig_handler);
 
-	if (inject_build_ids) {
+	if (inject_build_ids || inject_sched_stat) {
 		perf_inject.sample	 = perf_event__inject_buildid;
 		perf_inject.mmap	 = perf_event__repipe_mmap;
 		perf_inject.fork	 = perf_event__repipe_task;
 		perf_inject.tracing_data = perf_event__repipe_tracing_data;
-	} else if (inject_sched_stat) {
+	}
+
+	if (inject_sched_stat) {
 		perf_inject.sample	= perf_event__sched_stat;
 		perf_inject.ordered_samples = true;
 	}
diff --git a/tools/perf/util/build-id.c b/tools/perf/util/build-id.c
index fd9a594..9ce0e11 100644
--- a/tools/perf/util/build-id.c
+++ b/tools/perf/util/build-id.c
@@ -16,7 +16,7 @@
 #include "session.h"
 #include "tool.h"
 
-static int build_id__mark_dso_hit(struct perf_tool *tool __used,
+int build_id__mark_dso_hit(struct perf_tool *tool __used,
 				  union perf_event *event,
 				  struct perf_sample *sample __used,
 				  struct perf_evsel *evsel __used,
diff --git a/tools/perf/util/build-id.h b/tools/perf/util/build-id.h
index a993ba8..032a968 100644
--- a/tools/perf/util/build-id.h
+++ b/tools/perf/util/build-id.h
@@ -7,4 +7,9 @@ extern struct perf_tool build_id__mark_dso_hit_ops;
 
 char *dso__build_id_filename(struct dso *self, char *bf, size_t size);
 
+int build_id__mark_dso_hit(struct perf_tool *tool __used,
+				  union perf_event *event,
+				  struct perf_sample *sample __used,
+				  struct perf_evsel *evsel __used,
+				  struct machine *machine);
 #endif
-- 
1.7.1


  parent reply	other threads:[~2012-08-06 10:02 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-06 10:01 [PATCH 0/3] perf: Teach perf tool to profile sleep times Andrew Vagin
2012-08-06 10:01 ` [PATCH 1/3] perf: teach "perf inject" to work with files Andrew Vagin
2012-08-06 18:12   ` Arnaldo Carvalho de Melo
2012-08-06 10:01 ` [PATCH 2/3] perf: teach perf inject to merge sched_stat_* and sched_switch events Andrew Vagin
2012-08-06 18:19   ` Arnaldo Carvalho de Melo
2012-08-06 19:43     ` Andrey Wagin
2012-08-06 22:00       ` Arnaldo Carvalho de Melo
2012-08-06 23:31         ` Arnaldo Carvalho de Melo
2012-08-13  9:17           ` Ingo Molnar
2012-08-06 10:01 ` Andrew Vagin [this message]
2012-08-06 18:14   ` [PATCH 3/3] perf: mark a dso if it's used Arnaldo Carvalho de Melo
2012-08-06 19:50     ` Andrey Wagin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1344247319-304069-4-git-send-email-avagin@openvz.org \
    --to=avagin@openvz.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@ghostprotocols.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=paulus@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®