diff options
author | Steven Rostedt <srostedt@redhat.com> | 2009-03-04 22:15:30 -0500 |
---|---|---|
committer | Steven Rostedt <srostedt@redhat.com> | 2009-03-04 22:15:30 -0500 |
commit | e9d25fe6eaa2c720bb3ea661b660e58d54fa38bf (patch) | |
tree | 8121a9fc4021e86499c404e0b1012a36e8d0b00e /kernel | |
parent | 27d48be84477d2f0a2e2ac3738a3971dece631d5 (diff) |
tracing: have latency tracers set the latency format
The latency tracers (irqsoff, preemptoff, preemptirqsoff, and wakeup)
are pretty useless with the default output format. This patch makes them
automatically enable the latency format when they are selected. They
also record the state of the latency option, and if it was not enabled
when selected, they disable it on reset.
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/trace/trace_irqsoff.c | 8 | ||||
-rw-r--r-- | kernel/trace/trace_sched_wakeup.c | 8 |
2 files changed, 16 insertions, 0 deletions
diff --git a/kernel/trace/trace_irqsoff.c b/kernel/trace/trace_irqsoff.c index 9e5ebd844158..b923d13e2fad 100644 --- a/kernel/trace/trace_irqsoff.c +++ b/kernel/trace/trace_irqsoff.c | |||
@@ -32,6 +32,8 @@ enum { | |||
32 | 32 | ||
33 | static int trace_type __read_mostly; | 33 | static int trace_type __read_mostly; |
34 | 34 | ||
35 | static int save_lat_flag; | ||
36 | |||
35 | #ifdef CONFIG_PREEMPT_TRACER | 37 | #ifdef CONFIG_PREEMPT_TRACER |
36 | static inline int | 38 | static inline int |
37 | preempt_trace(void) | 39 | preempt_trace(void) |
@@ -370,6 +372,9 @@ static void stop_irqsoff_tracer(struct trace_array *tr) | |||
370 | 372 | ||
371 | static void __irqsoff_tracer_init(struct trace_array *tr) | 373 | static void __irqsoff_tracer_init(struct trace_array *tr) |
372 | { | 374 | { |
375 | save_lat_flag = trace_flags & TRACE_ITER_LATENCY_FMT; | ||
376 | trace_flags |= TRACE_ITER_LATENCY_FMT; | ||
377 | |||
373 | tracing_max_latency = 0; | 378 | tracing_max_latency = 0; |
374 | irqsoff_trace = tr; | 379 | irqsoff_trace = tr; |
375 | /* make sure that the tracer is visible */ | 380 | /* make sure that the tracer is visible */ |
@@ -380,6 +385,9 @@ static void __irqsoff_tracer_init(struct trace_array *tr) | |||
380 | static void irqsoff_tracer_reset(struct trace_array *tr) | 385 | static void irqsoff_tracer_reset(struct trace_array *tr) |
381 | { | 386 | { |
382 | stop_irqsoff_tracer(tr); | 387 | stop_irqsoff_tracer(tr); |
388 | |||
389 | if (!save_lat_flag) | ||
390 | trace_flags &= ~TRACE_ITER_LATENCY_FMT; | ||
383 | } | 391 | } |
384 | 392 | ||
385 | static void irqsoff_tracer_start(struct trace_array *tr) | 393 | static void irqsoff_tracer_start(struct trace_array *tr) |
diff --git a/kernel/trace/trace_sched_wakeup.c b/kernel/trace/trace_sched_wakeup.c index db55f7aaa640..3c5ad6b2ec84 100644 --- a/kernel/trace/trace_sched_wakeup.c +++ b/kernel/trace/trace_sched_wakeup.c | |||
@@ -32,6 +32,8 @@ static raw_spinlock_t wakeup_lock = | |||
32 | 32 | ||
33 | static void __wakeup_reset(struct trace_array *tr); | 33 | static void __wakeup_reset(struct trace_array *tr); |
34 | 34 | ||
35 | static int save_lat_flag; | ||
36 | |||
35 | #ifdef CONFIG_FUNCTION_TRACER | 37 | #ifdef CONFIG_FUNCTION_TRACER |
36 | /* | 38 | /* |
37 | * irqsoff uses its own tracer function to keep the overhead down: | 39 | * irqsoff uses its own tracer function to keep the overhead down: |
@@ -324,6 +326,9 @@ static void stop_wakeup_tracer(struct trace_array *tr) | |||
324 | 326 | ||
325 | static int __wakeup_tracer_init(struct trace_array *tr) | 327 | static int __wakeup_tracer_init(struct trace_array *tr) |
326 | { | 328 | { |
329 | save_lat_flag = trace_flags & TRACE_ITER_LATENCY_FMT; | ||
330 | trace_flags |= TRACE_ITER_LATENCY_FMT; | ||
331 | |||
327 | tracing_max_latency = 0; | 332 | tracing_max_latency = 0; |
328 | wakeup_trace = tr; | 333 | wakeup_trace = tr; |
329 | start_wakeup_tracer(tr); | 334 | start_wakeup_tracer(tr); |
@@ -347,6 +352,9 @@ static void wakeup_tracer_reset(struct trace_array *tr) | |||
347 | stop_wakeup_tracer(tr); | 352 | stop_wakeup_tracer(tr); |
348 | /* make sure we put back any tasks we are tracing */ | 353 | /* make sure we put back any tasks we are tracing */ |
349 | wakeup_reset(tr); | 354 | wakeup_reset(tr); |
355 | |||
356 | if (!save_lat_flag) | ||
357 | trace_flags &= ~TRACE_ITER_LATENCY_FMT; | ||
350 | } | 358 | } |
351 | 359 | ||
352 | static void wakeup_tracer_start(struct trace_array *tr) | 360 | static void wakeup_tracer_start(struct trace_array *tr) |