All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/3] perf script: Move evname print code to process_event()
@ 2013-11-18  5:34 Namhyung Kim
  2013-11-18  5:34 ` [PATCH v2 2/3] perf script: Print comm, fork and exit events also Namhyung Kim
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Namhyung Kim @ 2013-11-18  5:34 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Peter Zijlstra, Paul Mackerras, Ingo Molnar, Namhyung Kim, LKML,
	Frederic Weisbecker, Jiri Olsa, David Ahern

The print_sample_start() will be reused by other printing routine for
internal events like COMM, FORK and EXIT from next patch.  And because
they're not tied to a specific event, move the evname print code to
its caller.

Reviewed-by: David Ahern <dsahern@gmail.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/builtin-script.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index baf17989a216..b392770766dd 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -288,7 +288,6 @@ static void print_sample_start(struct perf_sample *sample,
 			       struct perf_evsel *evsel)
 {
 	struct perf_event_attr *attr = &evsel->attr;
-	const char *evname = NULL;
 	unsigned long secs;
 	unsigned long usecs;
 	unsigned long long nsecs;
@@ -323,11 +322,6 @@ static void print_sample_start(struct perf_sample *sample,
 		usecs = nsecs / NSECS_PER_USEC;
 		printf("%5lu.%06lu: ", secs, usecs);
 	}
-
-	if (PRINT_FIELD(EVNAME)) {
-		evname = perf_evsel__name(evsel);
-		printf("%s: ", evname ? evname : "[unknown]");
-	}
 }
 
 static bool is_bts_event(struct perf_event_attr *attr)
@@ -434,6 +428,11 @@ static void process_event(union perf_event *event, struct perf_sample *sample,
 
 	print_sample_start(sample, thread, evsel);
 
+	if (PRINT_FIELD(EVNAME)) {
+		const char *evname = perf_evsel__name(evsel);
+		printf("%s: ", evname ? evname : "[unknown]");
+	}
+
 	if (is_bts_event(attr)) {
 		print_sample_bts(event, sample, evsel, machine, thread);
 		return;
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-11-30 12:50 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-18  5:34 [PATCH v2 1/3] perf script: Move evname print code to process_event() Namhyung Kim
2013-11-18  5:34 ` [PATCH v2 2/3] perf script: Print comm, fork and exit events also Namhyung Kim
2013-11-18 13:57   ` Arnaldo Carvalho de Melo
2013-11-18 14:19     ` David Ahern
2013-11-19  0:18     ` Namhyung Kim
2013-11-25 13:42       ` Arnaldo Carvalho de Melo
2013-11-18  5:34 ` [PATCH v2 3/3] perf script: Print mmap[2] " Namhyung Kim
2013-11-30 12:50 ` [tip:perf/core] perf script: Move evname print code to process_event() tip-bot for Namhyung Kim

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.