diff options
author | Namhyung Kim <namhyung.kim@lge.com> | 2012-10-04 08:49:41 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-10-04 12:34:22 -0400 |
commit | b24c28f794e1821c1bba3ef7e9e948ab77ee00ac (patch) | |
tree | adeffc7cf0b7254f68e6a64640bf06cc677bcd4e /tools/perf | |
parent | b5ff71c3bab10a7a4b321b5de072ac5bd73ef9a4 (diff) |
perf hists: Introduce struct he_stat
The struct he_stat is for separating out statistics data of a hist
entry. It is required for later changes.
It's just a mechanical change and should have no functional differences.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Arun Sharma <asharma@fb.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1349354994-17853-8-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf')
-rw-r--r-- | tools/perf/ui/browsers/hists.c | 8 | ||||
-rw-r--r-- | tools/perf/ui/gtk/browser.c | 2 | ||||
-rw-r--r-- | tools/perf/ui/hist.c | 30 | ||||
-rw-r--r-- | tools/perf/ui/stdio/hist.c | 2 | ||||
-rw-r--r-- | tools/perf/util/hist.c | 52 | ||||
-rw-r--r-- | tools/perf/util/sort.h | 16 |
6 files changed, 59 insertions, 51 deletions
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c index d359795454d0..0568536ecf67 100644 --- a/tools/perf/ui/browsers/hists.c +++ b/tools/perf/ui/browsers/hists.c | |||
@@ -570,7 +570,7 @@ static int hist_browser__hpp_color_ ## _name(struct perf_hpp *hpp, \ | |||
570 | struct hist_entry *he) \ | 570 | struct hist_entry *he) \ |
571 | { \ | 571 | { \ |
572 | struct hists *hists = he->hists; \ | 572 | struct hists *hists = he->hists; \ |
573 | double percent = 100.0 * he->_field / hists->stats.total_period;\ | 573 | double percent = 100.0 * he->stat._field / hists->stats.total_period; \ |
574 | *(double *)hpp->ptr = percent; \ | 574 | *(double *)hpp->ptr = percent; \ |
575 | return scnprintf(hpp->buf, hpp->size, "%6.2f%%", percent); \ | 575 | return scnprintf(hpp->buf, hpp->size, "%6.2f%%", percent); \ |
576 | } | 576 | } |
@@ -982,7 +982,7 @@ static int hist_browser__fprintf_entry(struct hist_browser *browser, | |||
982 | folded_sign = hist_entry__folded(he); | 982 | folded_sign = hist_entry__folded(he); |
983 | 983 | ||
984 | hist_entry__sort_snprintf(he, s, sizeof(s), browser->hists); | 984 | hist_entry__sort_snprintf(he, s, sizeof(s), browser->hists); |
985 | percent = (he->period * 100.0) / browser->hists->stats.total_period; | 985 | percent = (he->stat.period * 100.0) / browser->hists->stats.total_period; |
986 | 986 | ||
987 | if (symbol_conf.use_callchain) | 987 | if (symbol_conf.use_callchain) |
988 | printed += fprintf(fp, "%c ", folded_sign); | 988 | printed += fprintf(fp, "%c ", folded_sign); |
@@ -990,10 +990,10 @@ static int hist_browser__fprintf_entry(struct hist_browser *browser, | |||
990 | printed += fprintf(fp, " %5.2f%%", percent); | 990 | printed += fprintf(fp, " %5.2f%%", percent); |
991 | 991 | ||
992 | if (symbol_conf.show_nr_samples) | 992 | if (symbol_conf.show_nr_samples) |
993 | printed += fprintf(fp, " %11u", he->nr_events); | 993 | printed += fprintf(fp, " %11u", he->stat.nr_events); |
994 | 994 | ||
995 | if (symbol_conf.show_total_period) | 995 | if (symbol_conf.show_total_period) |
996 | printed += fprintf(fp, " %12" PRIu64, he->period); | 996 | printed += fprintf(fp, " %12" PRIu64, he->stat.period); |
997 | 997 | ||
998 | printed += fprintf(fp, "%s\n", rtrim(s)); | 998 | printed += fprintf(fp, "%s\n", rtrim(s)); |
999 | 999 | ||
diff --git a/tools/perf/ui/gtk/browser.c b/tools/perf/ui/gtk/browser.c index 3cbb1d622ed2..4125c6284114 100644 --- a/tools/perf/ui/gtk/browser.c +++ b/tools/perf/ui/gtk/browser.c | |||
@@ -50,7 +50,7 @@ static int perf_gtk__hpp_color_ ## _name(struct perf_hpp *hpp, \ | |||
50 | struct hist_entry *he) \ | 50 | struct hist_entry *he) \ |
51 | { \ | 51 | { \ |
52 | struct hists *hists = he->hists; \ | 52 | struct hists *hists = he->hists; \ |
53 | double percent = 100.0 * he->_field / hists->stats.total_period; \ | 53 | double percent = 100.0 * he->stat._field / hists->stats.total_period; \ |
54 | const char *markup; \ | 54 | const char *markup; \ |
55 | int ret = 0; \ | 55 | int ret = 0; \ |
56 | \ | 56 | \ |
diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c index 7f043394bef1..f5a1e4f65263 100644 --- a/tools/perf/ui/hist.c +++ b/tools/perf/ui/hist.c | |||
@@ -19,7 +19,7 @@ static int hpp__width_overhead(struct perf_hpp *hpp __maybe_unused) | |||
19 | static int hpp__color_overhead(struct perf_hpp *hpp, struct hist_entry *he) | 19 | static int hpp__color_overhead(struct perf_hpp *hpp, struct hist_entry *he) |
20 | { | 20 | { |
21 | struct hists *hists = he->hists; | 21 | struct hists *hists = he->hists; |
22 | double percent = 100.0 * he->period / hists->stats.total_period; | 22 | double percent = 100.0 * he->stat.period / hists->stats.total_period; |
23 | 23 | ||
24 | return percent_color_snprintf(hpp->buf, hpp->size, " %6.2f%%", percent); | 24 | return percent_color_snprintf(hpp->buf, hpp->size, " %6.2f%%", percent); |
25 | } | 25 | } |
@@ -27,7 +27,7 @@ static int hpp__color_overhead(struct perf_hpp *hpp, struct hist_entry *he) | |||
27 | static int hpp__entry_overhead(struct perf_hpp *hpp, struct hist_entry *he) | 27 | static int hpp__entry_overhead(struct perf_hpp *hpp, struct hist_entry *he) |
28 | { | 28 | { |
29 | struct hists *hists = he->hists; | 29 | struct hists *hists = he->hists; |
30 | double percent = 100.0 * he->period / hists->stats.total_period; | 30 | double percent = 100.0 * he->stat.period / hists->stats.total_period; |
31 | const char *fmt = symbol_conf.field_sep ? "%.2f" : " %6.2f%%"; | 31 | const char *fmt = symbol_conf.field_sep ? "%.2f" : " %6.2f%%"; |
32 | 32 | ||
33 | return scnprintf(hpp->buf, hpp->size, fmt, percent); | 33 | return scnprintf(hpp->buf, hpp->size, fmt, percent); |
@@ -48,7 +48,7 @@ static int hpp__width_overhead_sys(struct perf_hpp *hpp __maybe_unused) | |||
48 | static int hpp__color_overhead_sys(struct perf_hpp *hpp, struct hist_entry *he) | 48 | static int hpp__color_overhead_sys(struct perf_hpp *hpp, struct hist_entry *he) |
49 | { | 49 | { |
50 | struct hists *hists = he->hists; | 50 | struct hists *hists = he->hists; |
51 | double percent = 100.0 * he->period_sys / hists->stats.total_period; | 51 | double percent = 100.0 * he->stat.period_sys / hists->stats.total_period; |
52 | 52 | ||
53 | return percent_color_snprintf(hpp->buf, hpp->size, "%6.2f%%", percent); | 53 | return percent_color_snprintf(hpp->buf, hpp->size, "%6.2f%%", percent); |
54 | } | 54 | } |
@@ -56,7 +56,7 @@ static int hpp__color_overhead_sys(struct perf_hpp *hpp, struct hist_entry *he) | |||
56 | static int hpp__entry_overhead_sys(struct perf_hpp *hpp, struct hist_entry *he) | 56 | static int hpp__entry_overhead_sys(struct perf_hpp *hpp, struct hist_entry *he) |
57 | { | 57 | { |
58 | struct hists *hists = he->hists; | 58 | struct hists *hists = he->hists; |
59 | double percent = 100.0 * he->period_sys / hists->stats.total_period; | 59 | double percent = 100.0 * he->stat.period_sys / hists->stats.total_period; |
60 | const char *fmt = symbol_conf.field_sep ? "%.2f" : "%6.2f%%"; | 60 | const char *fmt = symbol_conf.field_sep ? "%.2f" : "%6.2f%%"; |
61 | 61 | ||
62 | return scnprintf(hpp->buf, hpp->size, fmt, percent); | 62 | return scnprintf(hpp->buf, hpp->size, fmt, percent); |
@@ -77,7 +77,7 @@ static int hpp__width_overhead_us(struct perf_hpp *hpp __maybe_unused) | |||
77 | static int hpp__color_overhead_us(struct perf_hpp *hpp, struct hist_entry *he) | 77 | static int hpp__color_overhead_us(struct perf_hpp *hpp, struct hist_entry *he) |
78 | { | 78 | { |
79 | struct hists *hists = he->hists; | 79 | struct hists *hists = he->hists; |
80 | double percent = 100.0 * he->period_us / hists->stats.total_period; | 80 | double percent = 100.0 * he->stat.period_us / hists->stats.total_period; |
81 | 81 | ||
82 | return percent_color_snprintf(hpp->buf, hpp->size, "%6.2f%%", percent); | 82 | return percent_color_snprintf(hpp->buf, hpp->size, "%6.2f%%", percent); |
83 | } | 83 | } |
@@ -85,7 +85,7 @@ static int hpp__color_overhead_us(struct perf_hpp *hpp, struct hist_entry *he) | |||
85 | static int hpp__entry_overhead_us(struct perf_hpp *hpp, struct hist_entry *he) | 85 | static int hpp__entry_overhead_us(struct perf_hpp *hpp, struct hist_entry *he) |
86 | { | 86 | { |
87 | struct hists *hists = he->hists; | 87 | struct hists *hists = he->hists; |
88 | double percent = 100.0 * he->period_us / hists->stats.total_period; | 88 | double percent = 100.0 * he->stat.period_us / hists->stats.total_period; |
89 | const char *fmt = symbol_conf.field_sep ? "%.2f" : "%6.2f%%"; | 89 | const char *fmt = symbol_conf.field_sep ? "%.2f" : "%6.2f%%"; |
90 | 90 | ||
91 | return scnprintf(hpp->buf, hpp->size, fmt, percent); | 91 | return scnprintf(hpp->buf, hpp->size, fmt, percent); |
@@ -105,7 +105,7 @@ static int hpp__color_overhead_guest_sys(struct perf_hpp *hpp, | |||
105 | struct hist_entry *he) | 105 | struct hist_entry *he) |
106 | { | 106 | { |
107 | struct hists *hists = he->hists; | 107 | struct hists *hists = he->hists; |
108 | double percent = 100.0 * he->period_guest_sys / hists->stats.total_period; | 108 | double percent = 100.0 * he->stat.period_guest_sys / hists->stats.total_period; |
109 | 109 | ||
110 | return percent_color_snprintf(hpp->buf, hpp->size, " %6.2f%% ", percent); | 110 | return percent_color_snprintf(hpp->buf, hpp->size, " %6.2f%% ", percent); |
111 | } | 111 | } |
@@ -114,7 +114,7 @@ static int hpp__entry_overhead_guest_sys(struct perf_hpp *hpp, | |||
114 | struct hist_entry *he) | 114 | struct hist_entry *he) |
115 | { | 115 | { |
116 | struct hists *hists = he->hists; | 116 | struct hists *hists = he->hists; |
117 | double percent = 100.0 * he->period_guest_sys / hists->stats.total_period; | 117 | double percent = 100.0 * he->stat.period_guest_sys / hists->stats.total_period; |
118 | const char *fmt = symbol_conf.field_sep ? "%.2f" : " %6.2f%% "; | 118 | const char *fmt = symbol_conf.field_sep ? "%.2f" : " %6.2f%% "; |
119 | 119 | ||
120 | return scnprintf(hpp->buf, hpp->size, fmt, percent); | 120 | return scnprintf(hpp->buf, hpp->size, fmt, percent); |
@@ -134,7 +134,7 @@ static int hpp__color_overhead_guest_us(struct perf_hpp *hpp, | |||
134 | struct hist_entry *he) | 134 | struct hist_entry *he) |
135 | { | 135 | { |
136 | struct hists *hists = he->hists; | 136 | struct hists *hists = he->hists; |
137 | double percent = 100.0 * he->period_guest_us / hists->stats.total_period; | 137 | double percent = 100.0 * he->stat.period_guest_us / hists->stats.total_period; |
138 | 138 | ||
139 | return percent_color_snprintf(hpp->buf, hpp->size, " %6.2f%% ", percent); | 139 | return percent_color_snprintf(hpp->buf, hpp->size, " %6.2f%% ", percent); |
140 | } | 140 | } |
@@ -143,7 +143,7 @@ static int hpp__entry_overhead_guest_us(struct perf_hpp *hpp, | |||
143 | struct hist_entry *he) | 143 | struct hist_entry *he) |
144 | { | 144 | { |
145 | struct hists *hists = he->hists; | 145 | struct hists *hists = he->hists; |
146 | double percent = 100.0 * he->period_guest_us / hists->stats.total_period; | 146 | double percent = 100.0 * he->stat.period_guest_us / hists->stats.total_period; |
147 | const char *fmt = symbol_conf.field_sep ? "%.2f" : " %6.2f%% "; | 147 | const char *fmt = symbol_conf.field_sep ? "%.2f" : " %6.2f%% "; |
148 | 148 | ||
149 | return scnprintf(hpp->buf, hpp->size, fmt, percent); | 149 | return scnprintf(hpp->buf, hpp->size, fmt, percent); |
@@ -167,7 +167,7 @@ static double baseline_percent(struct hist_entry *he) | |||
167 | 167 | ||
168 | if (pair) { | 168 | if (pair) { |
169 | u64 total_period = pair_hists->stats.total_period; | 169 | u64 total_period = pair_hists->stats.total_period; |
170 | u64 base_period = pair->period; | 170 | u64 base_period = pair->stat.period; |
171 | 171 | ||
172 | percent = 100.0 * base_period / total_period; | 172 | percent = 100.0 * base_period / total_period; |
173 | } | 173 | } |
@@ -206,7 +206,7 @@ static int hpp__entry_samples(struct perf_hpp *hpp, struct hist_entry *he) | |||
206 | { | 206 | { |
207 | const char *fmt = symbol_conf.field_sep ? "%" PRIu64 : "%11" PRIu64; | 207 | const char *fmt = symbol_conf.field_sep ? "%" PRIu64 : "%11" PRIu64; |
208 | 208 | ||
209 | return scnprintf(hpp->buf, hpp->size, fmt, he->nr_events); | 209 | return scnprintf(hpp->buf, hpp->size, fmt, he->stat.nr_events); |
210 | } | 210 | } |
211 | 211 | ||
212 | static int hpp__header_period(struct perf_hpp *hpp) | 212 | static int hpp__header_period(struct perf_hpp *hpp) |
@@ -225,7 +225,7 @@ static int hpp__entry_period(struct perf_hpp *hpp, struct hist_entry *he) | |||
225 | { | 225 | { |
226 | const char *fmt = symbol_conf.field_sep ? "%" PRIu64 : "%12" PRIu64; | 226 | const char *fmt = symbol_conf.field_sep ? "%" PRIu64 : "%12" PRIu64; |
227 | 227 | ||
228 | return scnprintf(hpp->buf, hpp->size, fmt, he->period); | 228 | return scnprintf(hpp->buf, hpp->size, fmt, he->stat.period); |
229 | } | 229 | } |
230 | 230 | ||
231 | static int hpp__header_delta(struct perf_hpp *hpp) | 231 | static int hpp__header_delta(struct perf_hpp *hpp) |
@@ -253,11 +253,11 @@ static int hpp__entry_delta(struct perf_hpp *hpp, struct hist_entry *he) | |||
253 | 253 | ||
254 | old_total = pair_hists ? pair_hists->stats.total_period : 0; | 254 | old_total = pair_hists ? pair_hists->stats.total_period : 0; |
255 | if (old_total > 0 && pair) | 255 | if (old_total > 0 && pair) |
256 | old_percent = 100.0 * pair->period / old_total; | 256 | old_percent = 100.0 * pair->stat.period / old_total; |
257 | 257 | ||
258 | new_total = hists->stats.total_period; | 258 | new_total = hists->stats.total_period; |
259 | if (new_total > 0) | 259 | if (new_total > 0) |
260 | new_percent = 100.0 * he->period / new_total; | 260 | new_percent = 100.0 * he->stat.period / new_total; |
261 | 261 | ||
262 | diff = new_percent - old_percent; | 262 | diff = new_percent - old_percent; |
263 | if (fabs(diff) >= 0.01) | 263 | if (fabs(diff) >= 0.01) |
diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c index 850c6d293f46..fbd4e32d0743 100644 --- a/tools/perf/ui/stdio/hist.c +++ b/tools/perf/ui/stdio/hist.c | |||
@@ -271,7 +271,7 @@ static size_t hist_entry_callchain__fprintf(struct hist_entry *he, | |||
271 | { | 271 | { |
272 | switch (callchain_param.mode) { | 272 | switch (callchain_param.mode) { |
273 | case CHAIN_GRAPH_REL: | 273 | case CHAIN_GRAPH_REL: |
274 | return callchain__fprintf_graph(fp, &he->sorted_chain, he->period, | 274 | return callchain__fprintf_graph(fp, &he->sorted_chain, he->stat.period, |
275 | left_margin); | 275 | left_margin); |
276 | break; | 276 | break; |
277 | case CHAIN_GRAPH_ABS: | 277 | case CHAIN_GRAPH_ABS: |
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index 040f34c79a53..3197f3f50018 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c | |||
@@ -135,16 +135,16 @@ static void hist_entry__add_cpumode_period(struct hist_entry *he, | |||
135 | { | 135 | { |
136 | switch (cpumode) { | 136 | switch (cpumode) { |
137 | case PERF_RECORD_MISC_KERNEL: | 137 | case PERF_RECORD_MISC_KERNEL: |
138 | he->period_sys += period; | 138 | he->stat.period_sys += period; |
139 | break; | 139 | break; |
140 | case PERF_RECORD_MISC_USER: | 140 | case PERF_RECORD_MISC_USER: |
141 | he->period_us += period; | 141 | he->stat.period_us += period; |
142 | break; | 142 | break; |
143 | case PERF_RECORD_MISC_GUEST_KERNEL: | 143 | case PERF_RECORD_MISC_GUEST_KERNEL: |
144 | he->period_guest_sys += period; | 144 | he->stat.period_guest_sys += period; |
145 | break; | 145 | break; |
146 | case PERF_RECORD_MISC_GUEST_USER: | 146 | case PERF_RECORD_MISC_GUEST_USER: |
147 | he->period_guest_us += period; | 147 | he->stat.period_guest_us += period; |
148 | break; | 148 | break; |
149 | default: | 149 | default: |
150 | break; | 150 | break; |
@@ -153,13 +153,13 @@ static void hist_entry__add_cpumode_period(struct hist_entry *he, | |||
153 | 153 | ||
154 | static void hist_entry__decay(struct hist_entry *he) | 154 | static void hist_entry__decay(struct hist_entry *he) |
155 | { | 155 | { |
156 | he->period = (he->period * 7) / 8; | 156 | he->stat.period = (he->stat.period * 7) / 8; |
157 | he->nr_events = (he->nr_events * 7) / 8; | 157 | he->stat.nr_events = (he->stat.nr_events * 7) / 8; |
158 | } | 158 | } |
159 | 159 | ||
160 | static bool hists__decay_entry(struct hists *hists, struct hist_entry *he) | 160 | static bool hists__decay_entry(struct hists *hists, struct hist_entry *he) |
161 | { | 161 | { |
162 | u64 prev_period = he->period; | 162 | u64 prev_period = he->stat.period; |
163 | 163 | ||
164 | if (prev_period == 0) | 164 | if (prev_period == 0) |
165 | return true; | 165 | return true; |
@@ -167,9 +167,9 @@ static bool hists__decay_entry(struct hists *hists, struct hist_entry *he) | |||
167 | hist_entry__decay(he); | 167 | hist_entry__decay(he); |
168 | 168 | ||
169 | if (!he->filtered) | 169 | if (!he->filtered) |
170 | hists->stats.total_period -= prev_period - he->period; | 170 | hists->stats.total_period -= prev_period - he->stat.period; |
171 | 171 | ||
172 | return he->period == 0; | 172 | return he->stat.period == 0; |
173 | } | 173 | } |
174 | 174 | ||
175 | static void __hists__decay_entries(struct hists *hists, bool zap_user, | 175 | static void __hists__decay_entries(struct hists *hists, bool zap_user, |
@@ -223,7 +223,7 @@ static struct hist_entry *hist_entry__new(struct hist_entry *template) | |||
223 | 223 | ||
224 | if (he != NULL) { | 224 | if (he != NULL) { |
225 | *he = *template; | 225 | *he = *template; |
226 | he->nr_events = 1; | 226 | he->stat.nr_events = 1; |
227 | if (he->ms.map) | 227 | if (he->ms.map) |
228 | he->ms.map->referenced = true; | 228 | he->ms.map->referenced = true; |
229 | if (symbol_conf.use_callchain) | 229 | if (symbol_conf.use_callchain) |
@@ -238,7 +238,7 @@ static void hists__inc_nr_entries(struct hists *hists, struct hist_entry *h) | |||
238 | if (!h->filtered) { | 238 | if (!h->filtered) { |
239 | hists__calc_col_len(hists, h); | 239 | hists__calc_col_len(hists, h); |
240 | ++hists->nr_entries; | 240 | ++hists->nr_entries; |
241 | hists->stats.total_period += h->period; | 241 | hists->stats.total_period += h->stat.period; |
242 | } | 242 | } |
243 | } | 243 | } |
244 | 244 | ||
@@ -270,8 +270,8 @@ static struct hist_entry *add_hist_entry(struct hists *hists, | |||
270 | cmp = hist_entry__cmp(entry, he); | 270 | cmp = hist_entry__cmp(entry, he); |
271 | 271 | ||
272 | if (!cmp) { | 272 | if (!cmp) { |
273 | he->period += period; | 273 | he->stat.period += period; |
274 | ++he->nr_events; | 274 | ++he->stat.nr_events; |
275 | 275 | ||
276 | /* If the map of an existing hist_entry has | 276 | /* If the map of an existing hist_entry has |
277 | * become out-of-date due to an exec() or | 277 | * become out-of-date due to an exec() or |
@@ -321,7 +321,9 @@ struct hist_entry *__hists__add_branch_entry(struct hists *self, | |||
321 | .cpu = al->cpu, | 321 | .cpu = al->cpu, |
322 | .ip = bi->to.addr, | 322 | .ip = bi->to.addr, |
323 | .level = al->level, | 323 | .level = al->level, |
324 | .period = period, | 324 | .stat = { |
325 | .period = period, | ||
326 | }, | ||
325 | .parent = sym_parent, | 327 | .parent = sym_parent, |
326 | .filtered = symbol__parent_filter(sym_parent), | 328 | .filtered = symbol__parent_filter(sym_parent), |
327 | .branch_info = bi, | 329 | .branch_info = bi, |
@@ -344,7 +346,9 @@ struct hist_entry *__hists__add_entry(struct hists *self, | |||
344 | .cpu = al->cpu, | 346 | .cpu = al->cpu, |
345 | .ip = al->addr, | 347 | .ip = al->addr, |
346 | .level = al->level, | 348 | .level = al->level, |
347 | .period = period, | 349 | .stat = { |
350 | .period = period, | ||
351 | }, | ||
348 | .parent = sym_parent, | 352 | .parent = sym_parent, |
349 | .filtered = symbol__parent_filter(sym_parent), | 353 | .filtered = symbol__parent_filter(sym_parent), |
350 | .hists = self, | 354 | .hists = self, |
@@ -412,12 +416,12 @@ static bool hists__collapse_insert_entry(struct hists *hists __maybe_unused, | |||
412 | cmp = hist_entry__collapse(iter, he); | 416 | cmp = hist_entry__collapse(iter, he); |
413 | 417 | ||
414 | if (!cmp) { | 418 | if (!cmp) { |
415 | iter->period += he->period; | 419 | iter->stat.period += he->stat.period; |
416 | iter->period_sys += he->period_sys; | 420 | iter->stat.period_sys += he->stat.period_sys; |
417 | iter->period_us += he->period_us; | 421 | iter->stat.period_us += he->stat.period_us; |
418 | iter->period_guest_sys += he->period_guest_sys; | 422 | iter->stat.period_guest_sys += he->stat.period_guest_sys; |
419 | iter->period_guest_us += he->period_guest_us; | 423 | iter->stat.period_guest_us += he->stat.period_guest_us; |
420 | iter->nr_events += he->nr_events; | 424 | iter->stat.nr_events += he->stat.nr_events; |
421 | 425 | ||
422 | if (symbol_conf.use_callchain) { | 426 | if (symbol_conf.use_callchain) { |
423 | callchain_cursor_reset(&callchain_cursor); | 427 | callchain_cursor_reset(&callchain_cursor); |
@@ -520,7 +524,7 @@ static void __hists__insert_output_entry(struct rb_root *entries, | |||
520 | parent = *p; | 524 | parent = *p; |
521 | iter = rb_entry(parent, struct hist_entry, rb_node); | 525 | iter = rb_entry(parent, struct hist_entry, rb_node); |
522 | 526 | ||
523 | if (he->period > iter->period) | 527 | if (he->stat.period > iter->stat.period) |
524 | p = &(*p)->rb_left; | 528 | p = &(*p)->rb_left; |
525 | else | 529 | else |
526 | p = &(*p)->rb_right; | 530 | p = &(*p)->rb_right; |
@@ -581,8 +585,8 @@ static void hists__remove_entry_filter(struct hists *hists, struct hist_entry *h | |||
581 | if (h->ms.unfolded) | 585 | if (h->ms.unfolded) |
582 | hists->nr_entries += h->nr_rows; | 586 | hists->nr_entries += h->nr_rows; |
583 | h->row_offset = 0; | 587 | h->row_offset = 0; |
584 | hists->stats.total_period += h->period; | 588 | hists->stats.total_period += h->stat.period; |
585 | hists->stats.nr_events[PERF_RECORD_SAMPLE] += h->nr_events; | 589 | hists->stats.nr_events[PERF_RECORD_SAMPLE] += h->stat.nr_events; |
586 | 590 | ||
587 | hists__calc_col_len(hists, h); | 591 | hists__calc_col_len(hists, h); |
588 | } | 592 | } |
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h index f070b523c81a..5786f323b597 100644 --- a/tools/perf/util/sort.h +++ b/tools/perf/util/sort.h | |||
@@ -43,6 +43,15 @@ extern struct sort_entry sort_sym_from; | |||
43 | extern struct sort_entry sort_sym_to; | 43 | extern struct sort_entry sort_sym_to; |
44 | extern enum sort_type sort__first_dimension; | 44 | extern enum sort_type sort__first_dimension; |
45 | 45 | ||
46 | struct he_stat { | ||
47 | u64 period; | ||
48 | u64 period_sys; | ||
49 | u64 period_us; | ||
50 | u64 period_guest_sys; | ||
51 | u64 period_guest_us; | ||
52 | u32 nr_events; | ||
53 | }; | ||
54 | |||
46 | /** | 55 | /** |
47 | * struct hist_entry - histogram entry | 56 | * struct hist_entry - histogram entry |
48 | * | 57 | * |
@@ -52,16 +61,11 @@ extern enum sort_type sort__first_dimension; | |||
52 | struct hist_entry { | 61 | struct hist_entry { |
53 | struct rb_node rb_node_in; | 62 | struct rb_node rb_node_in; |
54 | struct rb_node rb_node; | 63 | struct rb_node rb_node; |
55 | u64 period; | 64 | struct he_stat stat; |
56 | u64 period_sys; | ||
57 | u64 period_us; | ||
58 | u64 period_guest_sys; | ||
59 | u64 period_guest_us; | ||
60 | struct map_symbol ms; | 65 | struct map_symbol ms; |
61 | struct thread *thread; | 66 | struct thread *thread; |
62 | u64 ip; | 67 | u64 ip; |
63 | s32 cpu; | 68 | s32 cpu; |
64 | u32 nr_events; | ||
65 | 69 | ||
66 | /* XXX These two should move to some tree widget lib */ | 70 | /* XXX These two should move to some tree widget lib */ |
67 | u16 row_offset; | 71 | u16 row_offset; |