diff options
author | Namhyung Kim <namhyung@kernel.org> | 2013-12-26 03:44:10 -0500 |
---|---|---|
committer | Jiri Olsa <jolsa@kernel.org> | 2014-06-01 08:35:00 -0400 |
commit | be7f855a3eebe07f797b9e4a43bf59bab8ca3dbe (patch) | |
tree | 9ca444fd94738d6c2307f3f0e17ada231918851c | |
parent | be1f13e30862ab6b0fffaecd556856a965cefa0c (diff) |
perf tools: Save callchain info for each cumulative entry
When accumulating callchain entry, also save current snapshot of the
chain so that it can show the rest of the chain.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Tested-by: Arun Sharma <asharma@fb.com>
Tested-by: Rodrigo Campos <rodrigo@sdfg.com.ar>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Link: http://lkml.kernel.org/r/1401335910-16832-10-git-send-email-namhyung@kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
-rw-r--r-- | tools/perf/util/hist.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index bf03db528db6..c6f5f5251aad 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c | |||
@@ -738,6 +738,14 @@ iter_add_single_cumulative_entry(struct hist_entry_iter *iter, | |||
738 | iter->he = he; | 738 | iter->he = he; |
739 | he_cache[iter->curr++] = he; | 739 | he_cache[iter->curr++] = he; |
740 | 740 | ||
741 | callchain_append(he->callchain, &callchain_cursor, sample->period); | ||
742 | |||
743 | /* | ||
744 | * We need to re-initialize the cursor since callchain_append() | ||
745 | * advanced the cursor to the end. | ||
746 | */ | ||
747 | callchain_cursor_commit(&callchain_cursor); | ||
748 | |||
741 | /* | 749 | /* |
742 | * The iter->he will be over-written after ->add_next_entry() | 750 | * The iter->he will be over-written after ->add_next_entry() |
743 | * called so inc stats for the original entry now. | 751 | * called so inc stats for the original entry now. |
@@ -760,8 +768,6 @@ iter_next_cumulative_entry(struct hist_entry_iter *iter, | |||
760 | if (node == NULL) | 768 | if (node == NULL) |
761 | return 0; | 769 | return 0; |
762 | 770 | ||
763 | callchain_cursor_advance(&callchain_cursor); | ||
764 | |||
765 | return fill_callchain_info(al, node, iter->hide_unresolved); | 771 | return fill_callchain_info(al, node, iter->hide_unresolved); |
766 | } | 772 | } |
767 | 773 | ||
@@ -785,6 +791,11 @@ iter_add_next_cumulative_entry(struct hist_entry_iter *iter, | |||
785 | .parent = iter->parent, | 791 | .parent = iter->parent, |
786 | }; | 792 | }; |
787 | int i; | 793 | int i; |
794 | struct callchain_cursor cursor; | ||
795 | |||
796 | callchain_cursor_snapshot(&cursor, &callchain_cursor); | ||
797 | |||
798 | callchain_cursor_advance(&callchain_cursor); | ||
788 | 799 | ||
789 | /* | 800 | /* |
790 | * Check if there's duplicate entries in the callchain. | 801 | * Check if there's duplicate entries in the callchain. |
@@ -804,6 +815,7 @@ iter_add_next_cumulative_entry(struct hist_entry_iter *iter, | |||
804 | iter->he = he; | 815 | iter->he = he; |
805 | he_cache[iter->curr++] = he; | 816 | he_cache[iter->curr++] = he; |
806 | 817 | ||
818 | callchain_append(he->callchain, &cursor, sample->period); | ||
807 | return 0; | 819 | return 0; |
808 | } | 820 | } |
809 | 821 | ||