diff options
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 | } |