From: Namhyung Kim Date: Mon, 18 Nov 2013 05:34:52 +0000 (+0900) Subject: perf script: Move evname print code to process_event() X-Git-Tag: v3.14-rc1~171^2~19^2~23 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e944d3d7d151eea149c62310eaff7b92c7732f58;p=kernel%2Fkernel-generic.git perf script: Move evname print code to process_event() 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. Signed-off-by: Namhyung Kim Reviewed-by: David Ahern Cc: David Ahern Cc: Frederic Weisbecker Cc: Ingo Molnar Cc: Jiri Olsa Cc: Namhyung Kim Cc: Paul Mackerras Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/1384752894-10974-1-git-send-email-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c index baf1798..b392770 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;