Commit b5130b1e authored by Carsten Emde's avatar Carsten Emde Committed by Steven Rostedt

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: default avatarCarsten Emde <C.Emde@osadl.org>
Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
parent 41dfba43
...@@ -825,6 +825,11 @@ static void trace_init_cmdlines(void) ...@@ -825,6 +825,11 @@ static void trace_init_cmdlines(void)
cmdline_idx = 0; cmdline_idx = 0;
} }
int is_tracing_stopped(void)
{
return trace_stop_count;
}
/** /**
* ftrace_off_permanent - disable all ftrace code permanently * ftrace_off_permanent - disable all ftrace code permanently
* *
......
...@@ -461,6 +461,7 @@ void tracing_stop_sched_switch_record(void); ...@@ -461,6 +461,7 @@ void tracing_stop_sched_switch_record(void);
void tracing_start_sched_switch_record(void); void tracing_start_sched_switch_record(void);
int register_tracer(struct tracer *type); int register_tracer(struct tracer *type);
void unregister_tracer(struct tracer *type); void unregister_tracer(struct tracer *type);
int is_tracing_stopped(void);
extern unsigned long nsecs_to_usecs(unsigned long nsecs); extern unsigned long nsecs_to_usecs(unsigned long nsecs);
......
...@@ -157,8 +157,10 @@ check_critical_timing(struct trace_array *tr, ...@@ -157,8 +157,10 @@ check_critical_timing(struct trace_array *tr,
data->critical_end = parent_ip; data->critical_end = parent_ip;
tracing_max_latency = delta; if (likely(!is_tracing_stopped())) {
update_max_tr_single(tr, current, cpu); tracing_max_latency = delta;
update_max_tr_single(tr, current, cpu);
}
max_sequence++; max_sequence++;
......
...@@ -162,8 +162,10 @@ probe_wakeup_sched_switch(struct rq *rq, struct task_struct *prev, ...@@ -162,8 +162,10 @@ probe_wakeup_sched_switch(struct rq *rq, struct task_struct *prev,
if (!report_latency(delta)) if (!report_latency(delta))
goto out_unlock; goto out_unlock;
tracing_max_latency = delta; if (likely(!is_tracing_stopped())) {
update_max_tr(wakeup_trace, wakeup_task, wakeup_cpu); tracing_max_latency = delta;
update_max_tr(wakeup_trace, wakeup_task, wakeup_cpu);
}
out_unlock: out_unlock:
__wakeup_reset(wakeup_trace); __wakeup_reset(wakeup_trace);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment