summaryrefslogtreecommitdiff
path: root/tools/perf/builtin-trace.c
diff options
context:
space:
mode:
authorFrederic Weisbecker <fweisbec@gmail.com>2010-05-27 17:46:25 +0400
committerFrederic Weisbecker <fweisbec@gmail.com>2010-06-25 01:36:05 +0400
commit6fcf7ddbb73d677b3bb7b16f0fff1419cb8349e9 (patch)
tree03d0135d2857251361bc3c1bdd728146ce9f6e94 /tools/perf/builtin-trace.c
parentaa59a48596d8358a908bfb458300b5625cd47785 (diff)
downloadlinux-6fcf7ddbb73d677b3bb7b16f0fff1419cb8349e9.tar.xz
perf: Don't print traces when debugging ordering
Errors due to ordering bugs are easily lost in the middle of traces. When we are in this mode, don't print the traces so that we don't miss the debugging messages. But display a comforting message if we didn't encounter any ordering problem. Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'tools/perf/builtin-trace.c')
-rw-r--r--tools/perf/builtin-trace.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index dddf3f01b5ab..83df8db4f358 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -13,6 +13,7 @@ static char const *script_name;
static char const *generate_script_lang;
static bool debug_ordering;
static u64 last_timestamp;
+static u64 nr_unordered;
static int default_start_script(const char *script __unused,
int argc __unused,
@@ -96,8 +97,10 @@ static int process_sample_event(event_t *event, struct perf_session *session)
pr_err("Samples misordered, previous: %llu "
"this: %llu\n", last_timestamp,
data.time);
+ nr_unordered++;
}
last_timestamp = data.time;
+ return 0;
}
/*
* FIXME: better resolve from pid from the struct trace_entry
@@ -132,9 +135,16 @@ static void sig_handler(int sig __unused)
static int __cmd_trace(struct perf_session *session)
{
+ int ret;
+
signal(SIGINT, sig_handler);
- return perf_session__process_events(session, &event_ops);
+ ret = perf_session__process_events(session, &event_ops);
+
+ if (debug_ordering)
+ pr_err("Misordered timestamps: %llu\n", nr_unordered);
+
+ return ret;
}
struct script_spec {