diff options
author | Steven Rostedt <srostedt@redhat.com> | 2010-04-27 21:04:24 -0400 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2010-04-27 21:04:24 -0400 |
commit | 37e44bc50d91df1fe7edcf6f02fe168c6d802e64 (patch) | |
tree | 40058a2b27e94400dc4345ba13b334fb732ae532 /kernel | |
parent | e330b3bcd83199dd63a819d8d12e40f9edae6c77 (diff) |
tracing: Fix sleep time function profiling
When sleep_time is off the function profiler ignores the time that a task
is scheduled out. When the task is scheduled out a timestamp is taken.
When the task is scheduled back in, the timestamp is compared to the
current time and the saved calltimes are adjusted accordingly.
But when stopping the function profiler, the sched switch hook that
does this adjustment was stopped before shutting down the tracer.
This allowed some tasks to not get their timestamps set when they
scheduled out. When the function profiler started again, this would
skew the times of the scheduler functions.
This patch moves the stopping of the sched switch to after the function
profiler is stopped. It also ignores zero set calltimes, which may
happen on start up.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/trace/ftrace.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 3bcb340d6f02..8c9c2934c45f 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c | |||
@@ -666,6 +666,10 @@ static void profile_graph_return(struct ftrace_graph_ret *trace) | |||
666 | if (!stat->hash || !ftrace_profile_enabled) | 666 | if (!stat->hash || !ftrace_profile_enabled) |
667 | goto out; | 667 | goto out; |
668 | 668 | ||
669 | /* If the calltime was zero'd ignore it */ | ||
670 | if (!trace->calltime) | ||
671 | goto out; | ||
672 | |||
669 | calltime = trace->rettime - trace->calltime; | 673 | calltime = trace->rettime - trace->calltime; |
670 | 674 | ||
671 | if (!(trace_flags & TRACE_ITER_GRAPH_TIME)) { | 675 | if (!(trace_flags & TRACE_ITER_GRAPH_TIME)) { |
@@ -3357,11 +3361,11 @@ void unregister_ftrace_graph(void) | |||
3357 | goto out; | 3361 | goto out; |
3358 | 3362 | ||
3359 | ftrace_graph_active--; | 3363 | ftrace_graph_active--; |
3360 | unregister_trace_sched_switch(ftrace_graph_probe_sched_switch); | ||
3361 | ftrace_graph_return = (trace_func_graph_ret_t)ftrace_stub; | 3364 | ftrace_graph_return = (trace_func_graph_ret_t)ftrace_stub; |
3362 | ftrace_graph_entry = ftrace_graph_entry_stub; | 3365 | ftrace_graph_entry = ftrace_graph_entry_stub; |
3363 | ftrace_shutdown(FTRACE_STOP_FUNC_RET); | 3366 | ftrace_shutdown(FTRACE_STOP_FUNC_RET); |
3364 | unregister_pm_notifier(&ftrace_suspend_notifier); | 3367 | unregister_pm_notifier(&ftrace_suspend_notifier); |
3368 | unregister_trace_sched_switch(ftrace_graph_probe_sched_switch); | ||
3365 | 3369 | ||
3366 | out: | 3370 | out: |
3367 | mutex_unlock(&ftrace_lock); | 3371 | mutex_unlock(&ftrace_lock); |