[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 7 Aug 2013 22:51:00 -0400
From: David Ahern <dsahern@...il.com>
To: acme@...stprotocols.net, linux-kernel@...r.kernel.org,
mingo@...nel.org
Cc: David Ahern <dsahern@...il.com>,
Frederic Weisbecker <fweisbec@...il.com>,
Jiri Olsa <jolsa@...hat.com>, Mike Galbraith <efault@....de>,
Namhyung Kim <namhyung@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Stephane Eranian <eranian@...gle.com>
Subject: [PATCH 18/19] perf sched timehist: Print all events in verbose mode
Useful for debugging and correlating extra events in a file with
the scheduling events collected.
Signed-off-by: David Ahern <dsahern@...il.com>
Cc: Frederic Weisbecker <fweisbec@...il.com>
Cc: Ingo Molnar <mingo@...nel.org>
Cc: Jiri Olsa <jolsa@...hat.com>
Cc: Mike Galbraith <efault@....de>
Cc: Namhyung Kim <namhyung@...nel.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Stephane Eranian <eranian@...gle.com>
---
tools/perf/builtin-sched.c | 57 ++++++++++++++++++++++++++++++++++++++++----
1 file changed, 53 insertions(+), 4 deletions(-)
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index f5e98f1..1be9081 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -1897,6 +1897,50 @@ static struct thread *timehist_get_thread(struct perf_evsel *evsel,
return thread;
}
+static void timehist_print_sched_event(struct perf_tool *tool,
+ struct perf_evsel *evsel,
+ struct perf_sample *sample,
+ struct machine *machine)
+{
+ struct perf_sched *sched = container_of(tool, struct perf_sched, tool);
+ struct thread *thread;
+ struct thread_runtime *tr;
+ const char *evname;
+ char tstr[64];
+
+ thread = machine__findnew_thread(machine, sample->tid);
+ if (thread == NULL)
+ return;
+
+ tr = thread__priv(thread);
+ if (tr == NULL) {
+ tr = thread__init_runtime(thread, sample->pid);
+ if (tr == NULL)
+ return;
+ }
+
+ printf("%15s ", timehist_time_str(tstr, sizeof(tstr), sample->time));
+ printf("[%02d] ", sample->cpu);
+ if (sched->show_cpu_visual && sched->max_cpu)
+ printf("%*s ", sched->max_cpu, "");
+
+ printf("%-*s ", comm_width, tr->commstr);
+
+ /* dt spacer */
+ printf(" %9s %9s ", "", "");
+
+ evname = perf_evsel__name(evsel);
+ printf("%s ", evname ? evname : "[unknown]");
+ if (evsel->attr.type == PERF_TYPE_TRACEPOINT) {
+ event_format__print(evsel->tp_format, sample->cpu,
+ sample->raw_data, sample->raw_size);
+ }
+
+ printf("\n");
+
+ return;
+}
+
static int timehist_sched_change_event(struct perf_tool *tool,
struct perf_evsel *evsel,
struct perf_sample *sample,
@@ -2079,12 +2123,14 @@ static void timehist_print_summary(struct perf_session *session)
printf_nsecs(total_run_time, 2);
printf("\n");
}
+
static int perf_timehist__process_sample(struct perf_tool *tool,
- union perf_event *event,
- struct perf_sample *sample,
- struct perf_evsel *evsel,
- struct machine *machine)
+ union perf_event *event,
+ struct perf_sample *sample,
+ struct perf_evsel *evsel,
+ struct machine *machine)
{
+ struct perf_sched *sched = container_of(tool, struct perf_sched, tool);
int err = 0;
evsel->hists.stats.total_period += sample->period;
@@ -2094,6 +2140,9 @@ static int perf_timehist__process_sample(struct perf_tool *tool,
tracepoint_handler f = evsel->handler.func;
evsel->handler.data = event;
+ if (sched->show_events && verbose)
+ timehist_print_sched_event(tool, evsel, sample, machine);
+
if (f)
err = f(tool, evsel, sample, machine);
}
--
1.7.10.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists