diff options
author | Carsten Emde <Carsten.Emde@osadl.org> | 2009-09-12 19:43:07 -0400 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2009-09-12 21:45:17 -0400 |
commit | b5130b1e7d3717d03ab1916b198bf0d49fa0a619 (patch) | |
tree | 67ee3282f6b6aa2e37864b938f67fd7e02b04394 | |
parent | 41dfba4367109b92d92ec6e059be6950497d932f (diff) |
tracing: do not update tracing_max_latency when tracer is stopped
The state of the function pair tracing_stop()/tracing_start() is
correctly considered when tracer data are updated. However, the global
and externally accessible variable tracing_max_latency is always updated
- even when tracing is stopped.
The update should only occur, if tracing was not stopped.
Signed-off-by: Carsten Emde <C.Emde@osadl.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r-- | kernel/trace/trace.c | 5 | ||||
-rw-r--r-- | kernel/trace/trace.h | 1 | ||||
-rw-r--r-- | kernel/trace/trace_irqsoff.c | 6 | ||||
-rw-r--r-- | kernel/trace/trace_sched_wakeup.c | 6 |
4 files changed, 14 insertions, 4 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 45c3f0352d78..ef82a7fabf3b 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -825,6 +825,11 @@ static void trace_init_cmdlines(void) | |||
825 | cmdline_idx = 0; | 825 | cmdline_idx = 0; |
826 | } | 826 | } |
827 | 827 | ||
828 | int is_tracing_stopped(void) | ||
829 | { | ||
830 | return trace_stop_count; | ||
831 | } | ||
832 | |||
828 | /** | 833 | /** |
829 | * ftrace_off_permanent - disable all ftrace code permanently | 834 | * ftrace_off_permanent - disable all ftrace code permanently |
830 | * | 835 | * |
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index 28247cecd955..4ad4e1ddcb9b 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h | |||
@@ -461,6 +461,7 @@ void tracing_stop_sched_switch_record(void); | |||
461 | void tracing_start_sched_switch_record(void); | 461 | void tracing_start_sched_switch_record(void); |
462 | int register_tracer(struct tracer *type); | 462 | int register_tracer(struct tracer *type); |
463 | void unregister_tracer(struct tracer *type); | 463 | void unregister_tracer(struct tracer *type); |
464 | int is_tracing_stopped(void); | ||
464 | 465 | ||
465 | extern unsigned long nsecs_to_usecs(unsigned long nsecs); | 466 | extern unsigned long nsecs_to_usecs(unsigned long nsecs); |
466 | 467 | ||
diff --git a/kernel/trace/trace_irqsoff.c b/kernel/trace/trace_irqsoff.c index 06f8ea9e4b9d..3aa7eaa2114c 100644 --- a/kernel/trace/trace_irqsoff.c +++ b/kernel/trace/trace_irqsoff.c | |||
@@ -157,8 +157,10 @@ check_critical_timing(struct trace_array *tr, | |||
157 | 157 | ||
158 | data->critical_end = parent_ip; | 158 | data->critical_end = parent_ip; |
159 | 159 | ||
160 | tracing_max_latency = delta; | 160 | if (likely(!is_tracing_stopped())) { |
161 | update_max_tr_single(tr, current, cpu); | 161 | tracing_max_latency = delta; |
162 | update_max_tr_single(tr, current, cpu); | ||
163 | } | ||
162 | 164 | ||
163 | max_sequence++; | 165 | max_sequence++; |
164 | 166 | ||
diff --git a/kernel/trace/trace_sched_wakeup.c b/kernel/trace/trace_sched_wakeup.c index 6e1529bc6172..26185d727676 100644 --- a/kernel/trace/trace_sched_wakeup.c +++ b/kernel/trace/trace_sched_wakeup.c | |||
@@ -162,8 +162,10 @@ probe_wakeup_sched_switch(struct rq *rq, struct task_struct *prev, | |||
162 | if (!report_latency(delta)) | 162 | if (!report_latency(delta)) |
163 | goto out_unlock; | 163 | goto out_unlock; |
164 | 164 | ||
165 | tracing_max_latency = delta; | 165 | if (likely(!is_tracing_stopped())) { |
166 | update_max_tr(wakeup_trace, wakeup_task, wakeup_cpu); | 166 | tracing_max_latency = delta; |
167 | update_max_tr(wakeup_trace, wakeup_task, wakeup_cpu); | ||
168 | } | ||
167 | 169 | ||
168 | out_unlock: | 170 | out_unlock: |
169 | __wakeup_reset(wakeup_trace); | 171 | __wakeup_reset(wakeup_trace); |