diff options
Diffstat (limited to 'tools/perf/util/hist.c')
| -rw-r--r-- | tools/perf/util/hist.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index 6e88b9e395df..182395546ddc 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | #include "evlist.h" | 6 | #include "evlist.h" |
| 7 | #include "evsel.h" | 7 | #include "evsel.h" |
| 8 | #include "annotate.h" | 8 | #include "annotate.h" |
| 9 | #include "ui/progress.h" | ||
| 9 | #include <math.h> | 10 | #include <math.h> |
| 10 | 11 | ||
| 11 | static bool hists__filter_entry_by_dso(struct hists *hists, | 12 | static bool hists__filter_entry_by_dso(struct hists *hists, |
| @@ -303,7 +304,7 @@ static struct hist_entry *hist_entry__new(struct hist_entry *template, | |||
| 303 | size_t callchain_size = 0; | 304 | size_t callchain_size = 0; |
| 304 | struct hist_entry *he; | 305 | struct hist_entry *he; |
| 305 | 306 | ||
| 306 | if (symbol_conf.use_callchain || symbol_conf.cumulate_callchain) | 307 | if (symbol_conf.use_callchain) |
| 307 | callchain_size = sizeof(struct callchain_root); | 308 | callchain_size = sizeof(struct callchain_root); |
| 308 | 309 | ||
| 309 | he = zalloc(sizeof(*he) + callchain_size); | 310 | he = zalloc(sizeof(*he) + callchain_size); |
| @@ -736,7 +737,7 @@ iter_add_single_cumulative_entry(struct hist_entry_iter *iter, | |||
| 736 | iter->he = he; | 737 | iter->he = he; |
| 737 | he_cache[iter->curr++] = he; | 738 | he_cache[iter->curr++] = he; |
| 738 | 739 | ||
| 739 | callchain_append(he->callchain, &callchain_cursor, sample->period); | 740 | hist_entry__append_callchain(he, sample); |
| 740 | 741 | ||
| 741 | /* | 742 | /* |
| 742 | * We need to re-initialize the cursor since callchain_append() | 743 | * We need to re-initialize the cursor since callchain_append() |
| @@ -809,7 +810,8 @@ iter_add_next_cumulative_entry(struct hist_entry_iter *iter, | |||
| 809 | iter->he = he; | 810 | iter->he = he; |
| 810 | he_cache[iter->curr++] = he; | 811 | he_cache[iter->curr++] = he; |
| 811 | 812 | ||
| 812 | callchain_append(he->callchain, &cursor, sample->period); | 813 | if (symbol_conf.use_callchain) |
| 814 | callchain_append(he->callchain, &cursor, sample->period); | ||
| 813 | return 0; | 815 | return 0; |
| 814 | } | 816 | } |
| 815 | 817 | ||
| @@ -945,6 +947,7 @@ void hist_entry__free(struct hist_entry *he) | |||
| 945 | zfree(&he->mem_info); | 947 | zfree(&he->mem_info); |
| 946 | zfree(&he->stat_acc); | 948 | zfree(&he->stat_acc); |
| 947 | free_srcline(he->srcline); | 949 | free_srcline(he->srcline); |
| 950 | free_callchain(he->callchain); | ||
| 948 | free(he); | 951 | free(he); |
| 949 | } | 952 | } |
| 950 | 953 | ||
| @@ -987,6 +990,7 @@ static bool hists__collapse_insert_entry(struct hists *hists __maybe_unused, | |||
| 987 | else | 990 | else |
| 988 | p = &(*p)->rb_right; | 991 | p = &(*p)->rb_right; |
| 989 | } | 992 | } |
| 993 | hists->nr_entries++; | ||
| 990 | 994 | ||
| 991 | rb_link_node(&he->rb_node_in, parent, p); | 995 | rb_link_node(&he->rb_node_in, parent, p); |
| 992 | rb_insert_color(&he->rb_node_in, root); | 996 | rb_insert_color(&he->rb_node_in, root); |
| @@ -1024,7 +1028,10 @@ void hists__collapse_resort(struct hists *hists, struct ui_progress *prog) | |||
| 1024 | if (!sort__need_collapse) | 1028 | if (!sort__need_collapse) |
| 1025 | return; | 1029 | return; |
| 1026 | 1030 | ||
| 1031 | hists->nr_entries = 0; | ||
| 1032 | |||
| 1027 | root = hists__get_rotate_entries_in(hists); | 1033 | root = hists__get_rotate_entries_in(hists); |
| 1034 | |||
| 1028 | next = rb_first(root); | 1035 | next = rb_first(root); |
| 1029 | 1036 | ||
| 1030 | while (next) { | 1037 | while (next) { |
| @@ -1119,7 +1126,7 @@ static void __hists__insert_output_entry(struct rb_root *entries, | |||
| 1119 | rb_insert_color(&he->rb_node, entries); | 1126 | rb_insert_color(&he->rb_node, entries); |
| 1120 | } | 1127 | } |
| 1121 | 1128 | ||
| 1122 | void hists__output_resort(struct hists *hists) | 1129 | void hists__output_resort(struct hists *hists, struct ui_progress *prog) |
| 1123 | { | 1130 | { |
| 1124 | struct rb_root *root; | 1131 | struct rb_root *root; |
| 1125 | struct rb_node *next; | 1132 | struct rb_node *next; |
| @@ -1148,6 +1155,9 @@ void hists__output_resort(struct hists *hists) | |||
| 1148 | 1155 | ||
| 1149 | if (!n->filtered) | 1156 | if (!n->filtered) |
| 1150 | hists__calc_col_len(hists, n); | 1157 | hists__calc_col_len(hists, n); |
| 1158 | |||
| 1159 | if (prog) | ||
| 1160 | ui_progress__update(prog, 1); | ||
| 1151 | } | 1161 | } |
| 1152 | } | 1162 | } |
| 1153 | 1163 | ||
