diff options
author | Steven Rostedt <srostedt@redhat.com> | 2009-03-24 23:17:58 -0400 |
---|---|---|
committer | Steven Rostedt <srostedt@redhat.com> | 2009-03-24 23:41:11 -0400 |
commit | a2a16d6a3156ef7309ca7328a20c35df9418e670 (patch) | |
tree | 8f21d9c56eb34f9bd1057929661c96d04329dd69 /kernel/trace/ftrace.c | |
parent | cafb168a1c92e4c9e1731fe3d666c39611762c49 (diff) |
function-graph: add option to calculate graph time or not
graph time is the time that a function is executing another function.
Thus if function A calls B, if graph-time is set, then the time for
A includes B. This is the default behavior. But if graph-time is off,
then the time spent executing B is subtracted from A.
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Diffstat (limited to 'kernel/trace/ftrace.c')
-rw-r--r-- | kernel/trace/ftrace.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index ed1fc5021d44..71e5faef12ab 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c | |||
@@ -604,6 +604,7 @@ static int profile_graph_entry(struct ftrace_graph_ent *trace) | |||
604 | static void profile_graph_return(struct ftrace_graph_ret *trace) | 604 | static void profile_graph_return(struct ftrace_graph_ret *trace) |
605 | { | 605 | { |
606 | struct ftrace_profile_stat *stat; | 606 | struct ftrace_profile_stat *stat; |
607 | unsigned long long calltime; | ||
607 | struct ftrace_profile *rec; | 608 | struct ftrace_profile *rec; |
608 | unsigned long flags; | 609 | unsigned long flags; |
609 | 610 | ||
@@ -612,9 +613,27 @@ static void profile_graph_return(struct ftrace_graph_ret *trace) | |||
612 | if (!stat->hash) | 613 | if (!stat->hash) |
613 | goto out; | 614 | goto out; |
614 | 615 | ||
616 | calltime = trace->rettime - trace->calltime; | ||
617 | |||
618 | if (!(trace_flags & TRACE_ITER_GRAPH_TIME)) { | ||
619 | int index; | ||
620 | |||
621 | index = trace->depth; | ||
622 | |||
623 | /* Append this call time to the parent time to subtract */ | ||
624 | if (index) | ||
625 | current->ret_stack[index - 1].subtime += calltime; | ||
626 | |||
627 | if (current->ret_stack[index].subtime < calltime) | ||
628 | calltime -= current->ret_stack[index].subtime; | ||
629 | else | ||
630 | calltime = 0; | ||
631 | } | ||
632 | |||
615 | rec = ftrace_find_profiled_func(stat, trace->func); | 633 | rec = ftrace_find_profiled_func(stat, trace->func); |
616 | if (rec) | 634 | if (rec) |
617 | rec->time += trace->rettime - trace->calltime; | 635 | rec->time += calltime; |
636 | |||
618 | out: | 637 | out: |
619 | local_irq_restore(flags); | 638 | local_irq_restore(flags); |
620 | } | 639 | } |