提交 e944d3d7 编写于 作者: N Namhyung Kim 提交者: Arnaldo Carvalho de Melo

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: NNamhyung Kim <namhyung@kernel.org>
Reviewed-by: NDavid Ahern <dsahern@gmail.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1384752894-10974-1-git-send-email-namhyung@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
上级 a8b4c701
...@@ -288,7 +288,6 @@ static void print_sample_start(struct perf_sample *sample, ...@@ -288,7 +288,6 @@ static void print_sample_start(struct perf_sample *sample,
struct perf_evsel *evsel) struct perf_evsel *evsel)
{ {
struct perf_event_attr *attr = &evsel->attr; struct perf_event_attr *attr = &evsel->attr;
const char *evname = NULL;
unsigned long secs; unsigned long secs;
unsigned long usecs; unsigned long usecs;
unsigned long long nsecs; unsigned long long nsecs;
...@@ -323,11 +322,6 @@ static void print_sample_start(struct perf_sample *sample, ...@@ -323,11 +322,6 @@ static void print_sample_start(struct perf_sample *sample,
usecs = nsecs / NSECS_PER_USEC; usecs = nsecs / NSECS_PER_USEC;
printf("%5lu.%06lu: ", secs, usecs); 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) 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, ...@@ -434,6 +428,11 @@ static void process_event(union perf_event *event, struct perf_sample *sample,
print_sample_start(sample, thread, evsel); 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)) { if (is_bts_event(attr)) {
print_sample_bts(event, sample, evsel, machine, thread); print_sample_bts(event, sample, evsel, machine, thread);
return; return;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册