diff options
Diffstat (limited to 'tools/perf/builtin-trace.c')
-rw-r--r-- | tools/perf/builtin-trace.c | 12 |
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; | |||
13 | static char const *generate_script_lang; | 13 | static char const *generate_script_lang; |
14 | static bool debug_ordering; | 14 | static bool debug_ordering; |
15 | static u64 last_timestamp; | 15 | static u64 last_timestamp; |
16 | static u64 nr_unordered; | ||
16 | 17 | ||
17 | static int default_start_script(const char *script __unused, | 18 | static int default_start_script(const char *script __unused, |
18 | int argc __unused, | 19 | int argc __unused, |
@@ -96,8 +97,10 @@ static int process_sample_event(event_t *event, struct perf_session *session) | |||
96 | pr_err("Samples misordered, previous: %llu " | 97 | pr_err("Samples misordered, previous: %llu " |
97 | "this: %llu\n", last_timestamp, | 98 | "this: %llu\n", last_timestamp, |
98 | data.time); | 99 | data.time); |
100 | nr_unordered++; | ||
99 | } | 101 | } |
100 | last_timestamp = data.time; | 102 | last_timestamp = data.time; |
103 | return 0; | ||
101 | } | 104 | } |
102 | /* | 105 | /* |
103 | * FIXME: better resolve from pid from the struct trace_entry | 106 | * FIXME: better resolve from pid from the struct trace_entry |
@@ -132,9 +135,16 @@ static void sig_handler(int sig __unused) | |||
132 | 135 | ||
133 | static int __cmd_trace(struct perf_session *session) | 136 | static int __cmd_trace(struct perf_session *session) |
134 | { | 137 | { |
138 | int ret; | ||
139 | |||
135 | signal(SIGINT, sig_handler); | 140 | signal(SIGINT, sig_handler); |
136 | 141 | ||
137 | return perf_session__process_events(session, &event_ops); | 142 | ret = perf_session__process_events(session, &event_ops); |
143 | |||
144 | if (debug_ordering) | ||
145 | pr_err("Misordered timestamps: %llu\n", nr_unordered); | ||
146 | |||
147 | return ret; | ||
138 | } | 148 | } |
139 | 149 | ||
140 | struct script_spec { | 150 | struct script_spec { |