diff options
author | Steven Rostedt <rostedt@goodmis.org> | 2008-11-12 17:52:38 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-11-13 03:49:24 -0500 |
commit | 12ef7d448613ead2babd41c3ebfa1fe03c20edef (patch) | |
tree | 252b12211d2bbf96e4a90625f0c6116c9a4bd7de /kernel/trace | |
parent | ee6bce52276c0717ed3e63296e5d9465d339e923 (diff) |
ftrace: CPU buffer start annotation clean ups
Impact: better handling of CPU buffer start annotation
Because of the confusion with the per CPU buffers wrapping where
one CPU might be more active at the end of the trace than the other
CPUs causing that one CPU to have a shorter history. Kernel
developers were confused by the "missing" data of that one CPU
at the beginning of the trace output. An annotation was added to
the trace output to show that the buffer had started:
# tracer: function
#
# TASK-PID CPU# TIMESTAMP FUNCTION
# | | | | |
##### CPU 3 buffer started ####
<idle>-0 [003] 158.192959: smp_apic_timer_interrupt
[...]
<idle>-0 [003] 161.556520: default_idle
##### CPU 1 buffer started ####
<idle>-0 [001] 161.592494: hrtimer_force_reprogram
[etc]
But this annotation gets a bit messy when tracers do not fill the
buffers. This patch does a couple of things:
One) it adds a flag to trace_options to disable these annotations
Two) it does not annotate if the tracer did not overflow its buffer.
This makes the output much cleaner.
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/trace')
-rw-r--r-- | kernel/trace/trace.c | 16 | ||||
-rw-r--r-- | kernel/trace/trace.h | 1 |
2 files changed, 16 insertions, 1 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 240423a9d1af..4a904623e05d 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -205,7 +205,8 @@ static DEFINE_MUTEX(trace_types_lock); | |||
205 | static DECLARE_WAIT_QUEUE_HEAD(trace_wait); | 205 | static DECLARE_WAIT_QUEUE_HEAD(trace_wait); |
206 | 206 | ||
207 | /* trace_flags holds trace_options default values */ | 207 | /* trace_flags holds trace_options default values */ |
208 | unsigned long trace_flags = TRACE_ITER_PRINT_PARENT | TRACE_ITER_PRINTK; | 208 | unsigned long trace_flags = TRACE_ITER_PRINT_PARENT | TRACE_ITER_PRINTK | |
209 | TRACE_ITER_ANNOTATE; | ||
209 | 210 | ||
210 | /** | 211 | /** |
211 | * trace_wake_up - wake up tasks waiting for trace input | 212 | * trace_wake_up - wake up tasks waiting for trace input |
@@ -261,6 +262,7 @@ static const char *trace_options[] = { | |||
261 | #ifdef CONFIG_BRANCH_TRACER | 262 | #ifdef CONFIG_BRANCH_TRACER |
262 | "branch", | 263 | "branch", |
263 | #endif | 264 | #endif |
265 | "annotate", | ||
264 | NULL | 266 | NULL |
265 | }; | 267 | }; |
266 | 268 | ||
@@ -1113,6 +1115,7 @@ void tracing_stop_function_trace(void) | |||
1113 | 1115 | ||
1114 | enum trace_file_type { | 1116 | enum trace_file_type { |
1115 | TRACE_FILE_LAT_FMT = 1, | 1117 | TRACE_FILE_LAT_FMT = 1, |
1118 | TRACE_FILE_ANNOTATE = 2, | ||
1116 | }; | 1119 | }; |
1117 | 1120 | ||
1118 | static void trace_iterator_increment(struct trace_iterator *iter, int cpu) | 1121 | static void trace_iterator_increment(struct trace_iterator *iter, int cpu) |
@@ -1532,6 +1535,12 @@ static void test_cpu_buff_start(struct trace_iterator *iter) | |||
1532 | { | 1535 | { |
1533 | struct trace_seq *s = &iter->seq; | 1536 | struct trace_seq *s = &iter->seq; |
1534 | 1537 | ||
1538 | if (!(trace_flags & TRACE_ITER_ANNOTATE)) | ||
1539 | return; | ||
1540 | |||
1541 | if (!(iter->iter_flags & TRACE_FILE_ANNOTATE)) | ||
1542 | return; | ||
1543 | |||
1535 | if (cpu_isset(iter->cpu, iter->started)) | 1544 | if (cpu_isset(iter->cpu, iter->started)) |
1536 | return; | 1545 | return; |
1537 | 1546 | ||
@@ -2132,6 +2141,11 @@ __tracing_open(struct inode *inode, struct file *file, int *ret) | |||
2132 | iter->trace = current_trace; | 2141 | iter->trace = current_trace; |
2133 | iter->pos = -1; | 2142 | iter->pos = -1; |
2134 | 2143 | ||
2144 | /* Annotate start of buffers if we had overruns */ | ||
2145 | if (ring_buffer_overruns(iter->tr->buffer)) | ||
2146 | iter->iter_flags |= TRACE_FILE_ANNOTATE; | ||
2147 | |||
2148 | |||
2135 | for_each_tracing_cpu(cpu) { | 2149 | for_each_tracing_cpu(cpu) { |
2136 | 2150 | ||
2137 | iter->buffer_iter[cpu] = | 2151 | iter->buffer_iter[cpu] = |
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index 9e015f5bea1d..790ea8c0e1f3 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h | |||
@@ -473,6 +473,7 @@ enum trace_iterator_flags { | |||
473 | #ifdef CONFIG_BRANCH_TRACER | 473 | #ifdef CONFIG_BRANCH_TRACER |
474 | TRACE_ITER_BRANCH = 0x1000, | 474 | TRACE_ITER_BRANCH = 0x1000, |
475 | #endif | 475 | #endif |
476 | TRACE_ITER_ANNOTATE = 0x2000, | ||
476 | }; | 477 | }; |
477 | 478 | ||
478 | /* | 479 | /* |