diff options
Diffstat (limited to 'tools/perf/builtin-trace.c')
-rw-r--r-- | tools/perf/builtin-trace.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index 2eefb33c967..77f556f7604 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c | |||
@@ -11,6 +11,8 @@ | |||
11 | 11 | ||
12 | static char const *script_name; | 12 | static char const *script_name; |
13 | static char const *generate_script_lang; | 13 | static char const *generate_script_lang; |
14 | static bool debug_ordering; | ||
15 | static u64 last_timestamp; | ||
14 | 16 | ||
15 | static int default_start_script(const char *script __unused, | 17 | static int default_start_script(const char *script __unused, |
16 | int argc __unused, | 18 | int argc __unused, |
@@ -87,6 +89,14 @@ static int process_sample_event(event_t *event, struct perf_session *session) | |||
87 | } | 89 | } |
88 | 90 | ||
89 | if (session->sample_type & PERF_SAMPLE_RAW) { | 91 | if (session->sample_type & PERF_SAMPLE_RAW) { |
92 | if (debug_ordering) { | ||
93 | if (data.time < last_timestamp) { | ||
94 | pr_err("Samples misordered, previous: %llu " | ||
95 | "this: %llu\n", last_timestamp, | ||
96 | data.time); | ||
97 | } | ||
98 | last_timestamp = data.time; | ||
99 | } | ||
90 | /* | 100 | /* |
91 | * FIXME: better resolve from pid from the struct trace_entry | 101 | * FIXME: better resolve from pid from the struct trace_entry |
92 | * field, although it should be the same than this perf | 102 | * field, although it should be the same than this perf |
@@ -108,6 +118,7 @@ static struct perf_event_ops event_ops = { | |||
108 | .event_type = event__process_event_type, | 118 | .event_type = event__process_event_type, |
109 | .tracing_data = event__process_tracing_data, | 119 | .tracing_data = event__process_tracing_data, |
110 | .build_id = event__process_build_id, | 120 | .build_id = event__process_build_id, |
121 | .ordered_samples = true, | ||
111 | }; | 122 | }; |
112 | 123 | ||
113 | extern volatile int session_done; | 124 | extern volatile int session_done; |
@@ -531,6 +542,8 @@ static const struct option options[] = { | |||
531 | "generate perf-trace.xx script in specified language"), | 542 | "generate perf-trace.xx script in specified language"), |
532 | OPT_STRING('i', "input", &input_name, "file", | 543 | OPT_STRING('i', "input", &input_name, "file", |
533 | "input file name"), | 544 | "input file name"), |
545 | OPT_BOOLEAN('d', "debug-ordering", &debug_ordering, | ||
546 | "check that samples time ordering is monotonic"), | ||
534 | 547 | ||
535 | OPT_END() | 548 | OPT_END() |
536 | }; | 549 | }; |