diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-06 12:30:52 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-06 12:30:52 -0400 |
commit | 4aed2fd8e3181fea7c09ba79cf64e7e3f4413bf9 (patch) | |
tree | 1f69733e5daab4915a76a41de0e4d1dc61e12cfb /tools/perf/builtin-trace.c | |
parent | 3a3527b6461b1298cc53ce72f336346739297ac8 (diff) | |
parent | fc9ea5a1e53ee54f681e226d735008e2a6f8f470 (diff) |
Merge branch 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (162 commits)
tracing/kprobes: unregister_trace_probe needs to be called under mutex
perf: expose event__process function
perf events: Fix mmap offset determination
perf, powerpc: fsl_emb: Restore setting perf_sample_data.period
perf, powerpc: Convert the FSL driver to use local64_t
perf tools: Don't keep unreferenced maps when unmaps are detected
perf session: Invalidate last_match when removing threads from rb_tree
perf session: Free the ref_reloc_sym memory at the right place
x86,mmiotrace: Add support for tracing STOS instruction
perf, sched migration: Librarize task states and event headers helpers
perf, sched migration: Librarize the GUI class
perf, sched migration: Make the GUI class client agnostic
perf, sched migration: Make it vertically scrollable
perf, sched migration: Parameterize cpu height and spacing
perf, sched migration: Fix key bindings
perf, sched migration: Ignore unhandled task states
perf, sched migration: Handle ignored migrate out events
perf: New migration tool overview
tracing: Drop cpparg() macro
perf: Use tracepoint_synchronize_unregister() to flush any pending tracepoint call
...
Fix up trivial conflicts in Makefile and drivers/cpufreq/cpufreq.c
Diffstat (limited to 'tools/perf/builtin-trace.c')
-rw-r--r-- | tools/perf/builtin-trace.c | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index dddf3f01b5ab..294da725a57d 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c | |||
@@ -11,8 +11,9 @@ | |||
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; | 14 | static bool debug_mode; |
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, |
@@ -91,13 +92,15 @@ static int process_sample_event(event_t *event, struct perf_session *session) | |||
91 | } | 92 | } |
92 | 93 | ||
93 | if (session->sample_type & PERF_SAMPLE_RAW) { | 94 | if (session->sample_type & PERF_SAMPLE_RAW) { |
94 | if (debug_ordering) { | 95 | if (debug_mode) { |
95 | if (data.time < last_timestamp) { | 96 | if (data.time < last_timestamp) { |
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 |
@@ -113,6 +116,15 @@ static int process_sample_event(event_t *event, struct perf_session *session) | |||
113 | return 0; | 116 | return 0; |
114 | } | 117 | } |
115 | 118 | ||
119 | static u64 nr_lost; | ||
120 | |||
121 | static int process_lost_event(event_t *event, struct perf_session *session __used) | ||
122 | { | ||
123 | nr_lost += event->lost.lost; | ||
124 | |||
125 | return 0; | ||
126 | } | ||
127 | |||
116 | static struct perf_event_ops event_ops = { | 128 | static struct perf_event_ops event_ops = { |
117 | .sample = process_sample_event, | 129 | .sample = process_sample_event, |
118 | .comm = event__process_comm, | 130 | .comm = event__process_comm, |
@@ -120,6 +132,7 @@ static struct perf_event_ops event_ops = { | |||
120 | .event_type = event__process_event_type, | 132 | .event_type = event__process_event_type, |
121 | .tracing_data = event__process_tracing_data, | 133 | .tracing_data = event__process_tracing_data, |
122 | .build_id = event__process_build_id, | 134 | .build_id = event__process_build_id, |
135 | .lost = process_lost_event, | ||
123 | .ordered_samples = true, | 136 | .ordered_samples = true, |
124 | }; | 137 | }; |
125 | 138 | ||
@@ -132,9 +145,18 @@ static void sig_handler(int sig __unused) | |||
132 | 145 | ||
133 | static int __cmd_trace(struct perf_session *session) | 146 | static int __cmd_trace(struct perf_session *session) |
134 | { | 147 | { |
148 | int ret; | ||
149 | |||
135 | signal(SIGINT, sig_handler); | 150 | signal(SIGINT, sig_handler); |
136 | 151 | ||
137 | return perf_session__process_events(session, &event_ops); | 152 | ret = perf_session__process_events(session, &event_ops); |
153 | |||
154 | if (debug_mode) { | ||
155 | pr_err("Misordered timestamps: %llu\n", nr_unordered); | ||
156 | pr_err("Lost events: %llu\n", nr_lost); | ||
157 | } | ||
158 | |||
159 | return ret; | ||
138 | } | 160 | } |
139 | 161 | ||
140 | struct script_spec { | 162 | struct script_spec { |
@@ -544,8 +566,8 @@ static const struct option options[] = { | |||
544 | "generate perf-trace.xx script in specified language"), | 566 | "generate perf-trace.xx script in specified language"), |
545 | OPT_STRING('i', "input", &input_name, "file", | 567 | OPT_STRING('i', "input", &input_name, "file", |
546 | "input file name"), | 568 | "input file name"), |
547 | OPT_BOOLEAN('d', "debug-ordering", &debug_ordering, | 569 | OPT_BOOLEAN('d', "debug-mode", &debug_mode, |
548 | "check that samples time ordering is monotonic"), | 570 | "do various checks like samples ordering and lost events"), |
549 | 571 | ||
550 | OPT_END() | 572 | OPT_END() |
551 | }; | 573 | }; |