blob: 849c40028e7bb0fd181d203d43ccdc0eb4fb3433 [file] [log] [blame]
Namhyung Kimea251d52012-09-03 11:53:06 +09001#include <math.h>
2
3#include "../util/hist.h"
4#include "../util/util.h"
5#include "../util/sort.h"
Namhyung Kim4fb71072013-01-22 18:09:34 +09006#include "../util/evsel.h"
Namhyung Kimea251d52012-09-03 11:53:06 +09007
8/* hist period print (hpp) functions */
Namhyung Kimea251d52012-09-03 11:53:06 +09009
Namhyung Kim4fb71072013-01-22 18:09:34 +090010typedef int (*hpp_snprint_fn)(char *buf, size_t size, const char *fmt, ...);
Namhyung Kimea251d52012-09-03 11:53:06 +090011
Namhyung Kim4fb71072013-01-22 18:09:34 +090012static int __hpp__percent_fmt(struct perf_hpp *hpp, struct hist_entry *he,
13 u64 (*get_field)(struct hist_entry *),
14 const char *fmt, hpp_snprint_fn print_fn)
Namhyung Kimea251d52012-09-03 11:53:06 +090015{
Namhyung Kim4fb71072013-01-22 18:09:34 +090016 int ret;
17 double percent = 0.0;
Jiri Olsab5ff71c2012-10-04 21:49:40 +090018 struct hists *hists = he->hists;
Namhyung Kimea251d52012-09-03 11:53:06 +090019
Namhyung Kim4fb71072013-01-22 18:09:34 +090020 if (hists->stats.total_period)
21 percent = 100.0 * get_field(he) / hists->stats.total_period;
22
23 ret = print_fn(hpp->buf, hpp->size, fmt, percent);
24 return ret;
Namhyung Kimea251d52012-09-03 11:53:06 +090025}
26
Namhyung Kim4fb71072013-01-22 18:09:34 +090027static int __hpp__raw_fmt(struct perf_hpp *hpp, struct hist_entry *he,
28 u64 (*get_field)(struct hist_entry *),
29 const char *fmt, hpp_snprint_fn print_fn)
Namhyung Kimea251d52012-09-03 11:53:06 +090030{
Namhyung Kim4fb71072013-01-22 18:09:34 +090031 int ret;
Namhyung Kimea251d52012-09-03 11:53:06 +090032
Namhyung Kim4fb71072013-01-22 18:09:34 +090033 ret = print_fn(hpp->buf, hpp->size, fmt, get_field(he));
34 return ret;
Namhyung Kimea251d52012-09-03 11:53:06 +090035}
36
Namhyung Kim9ffad982012-09-03 11:53:07 +090037
Namhyung Kim4fb71072013-01-22 18:09:34 +090038#define __HPP_HEADER_FN(_type, _str, _min_width, _unit_width) \
39static int hpp__header_##_type(struct perf_hpp *hpp) \
40{ \
41 int len = _min_width; \
42 \
43 return scnprintf(hpp->buf, hpp->size, "%*s", len, _str); \
Namhyung Kimea251d52012-09-03 11:53:06 +090044}
45
Namhyung Kim4fb71072013-01-22 18:09:34 +090046#define __HPP_WIDTH_FN(_type, _min_width, _unit_width) \
47static int hpp__width_##_type(struct perf_hpp *hpp __maybe_unused) \
48{ \
49 int len = _min_width; \
50 \
51 return len; \
Namhyung Kimea251d52012-09-03 11:53:06 +090052}
53
Namhyung Kim4fb71072013-01-22 18:09:34 +090054#define __HPP_COLOR_PERCENT_FN(_type, _field) \
55static u64 he_get_##_field(struct hist_entry *he) \
56{ \
57 return he->stat._field; \
58} \
59 \
60static int hpp__color_##_type(struct perf_hpp *hpp, struct hist_entry *he) \
61{ \
62 return __hpp__percent_fmt(hpp, he, he_get_##_field, " %6.2f%%", \
63 (hpp_snprint_fn)percent_color_snprintf); \
Namhyung Kimea251d52012-09-03 11:53:06 +090064}
65
Namhyung Kim4fb71072013-01-22 18:09:34 +090066#define __HPP_ENTRY_PERCENT_FN(_type, _field) \
67static int hpp__entry_##_type(struct perf_hpp *hpp, struct hist_entry *he) \
68{ \
69 const char *fmt = symbol_conf.field_sep ? " %.2f" : " %6.2f%%"; \
70 return __hpp__percent_fmt(hpp, he, he_get_##_field, fmt, \
71 scnprintf); \
Namhyung Kimea251d52012-09-03 11:53:06 +090072}
73
Namhyung Kim4fb71072013-01-22 18:09:34 +090074#define __HPP_ENTRY_RAW_FN(_type, _field) \
75static u64 he_get_raw_##_field(struct hist_entry *he) \
76{ \
77 return he->stat._field; \
78} \
79 \
80static int hpp__entry_##_type(struct perf_hpp *hpp, struct hist_entry *he) \
81{ \
82 const char *fmt = symbol_conf.field_sep ? " %"PRIu64 : " %11"PRIu64; \
83 return __hpp__raw_fmt(hpp, he, he_get_raw_##_field, fmt, scnprintf); \
Namhyung Kimea251d52012-09-03 11:53:06 +090084}
85
Namhyung Kim4fb71072013-01-22 18:09:34 +090086#define HPP_PERCENT_FNS(_type, _str, _field, _min_width, _unit_width) \
87__HPP_HEADER_FN(_type, _str, _min_width, _unit_width) \
88__HPP_WIDTH_FN(_type, _min_width, _unit_width) \
89__HPP_COLOR_PERCENT_FN(_type, _field) \
90__HPP_ENTRY_PERCENT_FN(_type, _field)
Namhyung Kimea251d52012-09-03 11:53:06 +090091
Namhyung Kim4fb71072013-01-22 18:09:34 +090092#define HPP_RAW_FNS(_type, _str, _field, _min_width, _unit_width) \
93__HPP_HEADER_FN(_type, _str, _min_width, _unit_width) \
94__HPP_WIDTH_FN(_type, _min_width, _unit_width) \
95__HPP_ENTRY_RAW_FN(_type, _field)
Jiri Olsab5ff71c2012-10-04 21:49:40 +090096
Namhyung Kimea251d52012-09-03 11:53:06 +090097
Namhyung Kim4fb71072013-01-22 18:09:34 +090098HPP_PERCENT_FNS(overhead, "Overhead", period, 8, 8)
99HPP_PERCENT_FNS(overhead_sys, "sys", period_sys, 8, 8)
100HPP_PERCENT_FNS(overhead_us, "usr", period_us, 8, 8)
101HPP_PERCENT_FNS(overhead_guest_sys, "guest sys", period_guest_sys, 9, 8)
102HPP_PERCENT_FNS(overhead_guest_us, "guest usr", period_guest_us, 9, 8)
Namhyung Kim9ffad982012-09-03 11:53:07 +0900103
Namhyung Kim4fb71072013-01-22 18:09:34 +0900104HPP_RAW_FNS(samples, "Samples", nr_events, 12, 12)
105HPP_RAW_FNS(period, "Period", period, 12, 12)
Namhyung Kimea251d52012-09-03 11:53:06 +0900106
Namhyung Kimea251d52012-09-03 11:53:06 +0900107
Jiri Olsa5395a042012-10-04 21:49:37 +0900108static int hpp__header_baseline(struct perf_hpp *hpp)
109{
110 return scnprintf(hpp->buf, hpp->size, "Baseline");
111}
112
113static int hpp__width_baseline(struct perf_hpp *hpp __maybe_unused)
114{
115 return 8;
116}
117
118static double baseline_percent(struct hist_entry *he)
119{
Arnaldo Carvalho de Melob821c732012-10-25 14:42:45 -0200120 struct hist_entry *pair = hist_entry__next_pair(he);
Jiri Olsa5395a042012-10-04 21:49:37 +0900121 struct hists *pair_hists = pair ? pair->hists : NULL;
122 double percent = 0.0;
123
124 if (pair) {
125 u64 total_period = pair_hists->stats.total_period;
Namhyung Kimb24c28f2012-10-04 21:49:41 +0900126 u64 base_period = pair->stat.period;
Jiri Olsa5395a042012-10-04 21:49:37 +0900127
128 percent = 100.0 * base_period / total_period;
129 }
130
131 return percent;
132}
133
134static int hpp__color_baseline(struct perf_hpp *hpp, struct hist_entry *he)
135{
136 double percent = baseline_percent(he);
137
Namhyung Kim4fb71072013-01-22 18:09:34 +0900138 if (hist_entry__has_pairs(he) || symbol_conf.field_sep)
Jiri Olsa6e923492012-10-05 16:44:47 +0200139 return percent_color_snprintf(hpp->buf, hpp->size, " %6.2f%%", percent);
140 else
141 return scnprintf(hpp->buf, hpp->size, " ");
Jiri Olsa5395a042012-10-04 21:49:37 +0900142}
143
144static int hpp__entry_baseline(struct perf_hpp *hpp, struct hist_entry *he)
145{
146 double percent = baseline_percent(he);
147 const char *fmt = symbol_conf.field_sep ? "%.2f" : " %6.2f%%";
148
Arnaldo Carvalho de Melob821c732012-10-25 14:42:45 -0200149 if (hist_entry__has_pairs(he) || symbol_conf.field_sep)
Jiri Olsa6e923492012-10-05 16:44:47 +0200150 return scnprintf(hpp->buf, hpp->size, fmt, percent);
151 else
152 return scnprintf(hpp->buf, hpp->size, " ");
Jiri Olsa5395a042012-10-04 21:49:37 +0900153}
154
Jiri Olsa61949b22012-10-05 16:44:44 +0200155static int hpp__header_period_baseline(struct perf_hpp *hpp)
156{
157 const char *fmt = symbol_conf.field_sep ? "%s" : "%12s";
158
159 return scnprintf(hpp->buf, hpp->size, fmt, "Period Base");
160}
161
162static int hpp__width_period_baseline(struct perf_hpp *hpp __maybe_unused)
163{
164 return 12;
165}
166
167static int hpp__entry_period_baseline(struct perf_hpp *hpp, struct hist_entry *he)
168{
Arnaldo Carvalho de Melob821c732012-10-25 14:42:45 -0200169 struct hist_entry *pair = hist_entry__next_pair(he);
Jiri Olsa61949b22012-10-05 16:44:44 +0200170 u64 period = pair ? pair->stat.period : 0;
171 const char *fmt = symbol_conf.field_sep ? "%" PRIu64 : "%12" PRIu64;
172
173 return scnprintf(hpp->buf, hpp->size, fmt, period);
174}
Namhyung Kim4fb71072013-01-22 18:09:34 +0900175
Namhyung Kimea251d52012-09-03 11:53:06 +0900176static int hpp__header_delta(struct perf_hpp *hpp)
177{
Namhyung Kim9ffad982012-09-03 11:53:07 +0900178 const char *fmt = symbol_conf.field_sep ? "%s" : "%7s";
179
180 return scnprintf(hpp->buf, hpp->size, fmt, "Delta");
Namhyung Kimea251d52012-09-03 11:53:06 +0900181}
182
Irina Tirdea1d037ca2012-09-11 01:15:03 +0300183static int hpp__width_delta(struct perf_hpp *hpp __maybe_unused)
Namhyung Kimea251d52012-09-03 11:53:06 +0900184{
185 return 7;
186}
187
188static int hpp__entry_delta(struct perf_hpp *hpp, struct hist_entry *he)
189{
Jiri Olsa05472da2012-11-28 14:52:40 +0100190 struct hist_entry *pair = hist_entry__next_pair(he);
Namhyung Kim9ffad982012-09-03 11:53:07 +0900191 const char *fmt = symbol_conf.field_sep ? "%s" : "%7.7s";
192 char buf[32] = " ";
Jiri Olsa05472da2012-11-28 14:52:40 +0100193 double diff = 0.0;
Namhyung Kimea251d52012-09-03 11:53:06 +0900194
Jiri Olsa05472da2012-11-28 14:52:40 +0100195 if (pair) {
196 if (he->diff.computed)
197 diff = he->diff.period_ratio_delta;
198 else
199 diff = perf_diff__compute_delta(he, pair);
200 } else
201 diff = perf_diff__period_percent(he, he->stat.period);
Namhyung Kimea251d52012-09-03 11:53:06 +0900202
Namhyung Kim9ffad982012-09-03 11:53:07 +0900203 if (fabs(diff) >= 0.01)
204 scnprintf(buf, sizeof(buf), "%+4.2F%%", diff);
Namhyung Kimea251d52012-09-03 11:53:06 +0900205
Namhyung Kim9ffad982012-09-03 11:53:07 +0900206 return scnprintf(hpp->buf, hpp->size, fmt, buf);
Namhyung Kimea251d52012-09-03 11:53:06 +0900207}
208
Jiri Olsa7aaf6b32012-10-05 16:44:41 +0200209static int hpp__header_ratio(struct perf_hpp *hpp)
210{
211 const char *fmt = symbol_conf.field_sep ? "%s" : "%14s";
212
213 return scnprintf(hpp->buf, hpp->size, fmt, "Ratio");
214}
215
216static int hpp__width_ratio(struct perf_hpp *hpp __maybe_unused)
217{
218 return 14;
219}
220
221static int hpp__entry_ratio(struct perf_hpp *hpp, struct hist_entry *he)
222{
Jiri Olsa05472da2012-11-28 14:52:40 +0100223 struct hist_entry *pair = hist_entry__next_pair(he);
Jiri Olsa7aaf6b32012-10-05 16:44:41 +0200224 const char *fmt = symbol_conf.field_sep ? "%s" : "%14s";
225 char buf[32] = " ";
Jiri Olsa05472da2012-11-28 14:52:40 +0100226 double ratio = 0.0;
Jiri Olsa96c47f12012-10-05 16:44:42 +0200227
Jiri Olsa05472da2012-11-28 14:52:40 +0100228 if (pair) {
229 if (he->diff.computed)
230 ratio = he->diff.period_ratio;
231 else
232 ratio = perf_diff__compute_ratio(he, pair);
233 }
Jiri Olsa7aaf6b32012-10-05 16:44:41 +0200234
235 if (ratio > 0.0)
236 scnprintf(buf, sizeof(buf), "%+14.6F", ratio);
237
238 return scnprintf(hpp->buf, hpp->size, fmt, buf);
239}
240
Jiri Olsa81d5f952012-10-05 16:44:43 +0200241static int hpp__header_wdiff(struct perf_hpp *hpp)
242{
243 const char *fmt = symbol_conf.field_sep ? "%s" : "%14s";
244
245 return scnprintf(hpp->buf, hpp->size, fmt, "Weighted diff");
246}
247
248static int hpp__width_wdiff(struct perf_hpp *hpp __maybe_unused)
249{
250 return 14;
251}
252
253static int hpp__entry_wdiff(struct perf_hpp *hpp, struct hist_entry *he)
254{
Jiri Olsa05472da2012-11-28 14:52:40 +0100255 struct hist_entry *pair = hist_entry__next_pair(he);
Jiri Olsa81d5f952012-10-05 16:44:43 +0200256 const char *fmt = symbol_conf.field_sep ? "%s" : "%14s";
257 char buf[32] = " ";
Jiri Olsa05472da2012-11-28 14:52:40 +0100258 s64 wdiff = 0;
Jiri Olsa81d5f952012-10-05 16:44:43 +0200259
Jiri Olsa05472da2012-11-28 14:52:40 +0100260 if (pair) {
261 if (he->diff.computed)
262 wdiff = he->diff.wdiff;
263 else
264 wdiff = perf_diff__compute_wdiff(he, pair);
265 }
Jiri Olsa81d5f952012-10-05 16:44:43 +0200266
267 if (wdiff != 0)
268 scnprintf(buf, sizeof(buf), "%14ld", wdiff);
269
270 return scnprintf(hpp->buf, hpp->size, fmt, buf);
271}
272
Jiri Olsaed279da2012-10-05 16:44:45 +0200273static int hpp__header_formula(struct perf_hpp *hpp)
274{
275 const char *fmt = symbol_conf.field_sep ? "%s" : "%70s";
276
277 return scnprintf(hpp->buf, hpp->size, fmt, "Formula");
278}
279
280static int hpp__width_formula(struct perf_hpp *hpp __maybe_unused)
281{
282 return 70;
283}
284
285static int hpp__entry_formula(struct perf_hpp *hpp, struct hist_entry *he)
286{
Jiri Olsaf4c8bae2012-11-28 14:52:41 +0100287 struct hist_entry *pair = hist_entry__next_pair(he);
Jiri Olsaed279da2012-10-05 16:44:45 +0200288 const char *fmt = symbol_conf.field_sep ? "%s" : "%-70s";
289 char buf[96] = " ";
290
Jiri Olsaf4c8bae2012-11-28 14:52:41 +0100291 if (pair)
292 perf_diff__formula(he, pair, buf, sizeof(buf));
293
Jiri Olsaed279da2012-10-05 16:44:45 +0200294 return scnprintf(hpp->buf, hpp->size, fmt, buf);
295}
296
Jiri Olsa12400052012-10-13 00:06:16 +0200297#define HPP__COLOR_PRINT_FNS(_name) \
298 { \
299 .header = hpp__header_ ## _name, \
300 .width = hpp__width_ ## _name, \
301 .color = hpp__color_ ## _name, \
302 .entry = hpp__entry_ ## _name \
303 }
Namhyung Kimea251d52012-09-03 11:53:06 +0900304
Jiri Olsa12400052012-10-13 00:06:16 +0200305#define HPP__PRINT_FNS(_name) \
306 { \
307 .header = hpp__header_ ## _name, \
308 .width = hpp__width_ ## _name, \
309 .entry = hpp__entry_ ## _name \
310 }
Namhyung Kimea251d52012-09-03 11:53:06 +0900311
312struct perf_hpp_fmt perf_hpp__format[] = {
Jiri Olsa12400052012-10-13 00:06:16 +0200313 HPP__COLOR_PRINT_FNS(baseline),
314 HPP__COLOR_PRINT_FNS(overhead),
315 HPP__COLOR_PRINT_FNS(overhead_sys),
316 HPP__COLOR_PRINT_FNS(overhead_us),
317 HPP__COLOR_PRINT_FNS(overhead_guest_sys),
318 HPP__COLOR_PRINT_FNS(overhead_guest_us),
319 HPP__PRINT_FNS(samples),
320 HPP__PRINT_FNS(period),
321 HPP__PRINT_FNS(period_baseline),
322 HPP__PRINT_FNS(delta),
323 HPP__PRINT_FNS(ratio),
324 HPP__PRINT_FNS(wdiff),
Jiri Olsa12400052012-10-13 00:06:16 +0200325 HPP__PRINT_FNS(formula)
Namhyung Kimea251d52012-09-03 11:53:06 +0900326};
327
Jiri Olsa12400052012-10-13 00:06:16 +0200328LIST_HEAD(perf_hpp__list);
329
Namhyung Kim4fb71072013-01-22 18:09:34 +0900330
Namhyung Kimea251d52012-09-03 11:53:06 +0900331#undef HPP__COLOR_PRINT_FNS
332#undef HPP__PRINT_FNS
333
Namhyung Kim4fb71072013-01-22 18:09:34 +0900334#undef HPP_PERCENT_FNS
335#undef HPP_RAW_FNS
336
337#undef __HPP_HEADER_FN
338#undef __HPP_WIDTH_FN
339#undef __HPP_COLOR_PERCENT_FN
340#undef __HPP_ENTRY_PERCENT_FN
341#undef __HPP_ENTRY_RAW_FN
342
343
Jiri Olsa1d778222012-10-04 21:49:39 +0900344void perf_hpp__init(void)
Namhyung Kimea251d52012-09-03 11:53:06 +0900345{
346 if (symbol_conf.show_cpu_utilization) {
Jiri Olsa12400052012-10-13 00:06:16 +0200347 perf_hpp__column_enable(PERF_HPP__OVERHEAD_SYS);
348 perf_hpp__column_enable(PERF_HPP__OVERHEAD_US);
Namhyung Kimea251d52012-09-03 11:53:06 +0900349
350 if (perf_guest) {
Jiri Olsa12400052012-10-13 00:06:16 +0200351 perf_hpp__column_enable(PERF_HPP__OVERHEAD_GUEST_SYS);
352 perf_hpp__column_enable(PERF_HPP__OVERHEAD_GUEST_US);
Namhyung Kimea251d52012-09-03 11:53:06 +0900353 }
354 }
355
356 if (symbol_conf.show_nr_samples)
Jiri Olsa12400052012-10-13 00:06:16 +0200357 perf_hpp__column_enable(PERF_HPP__SAMPLES);
Namhyung Kimea251d52012-09-03 11:53:06 +0900358
359 if (symbol_conf.show_total_period)
Jiri Olsa12400052012-10-13 00:06:16 +0200360 perf_hpp__column_enable(PERF_HPP__PERIOD);
Jiri Olsa1d778222012-10-04 21:49:39 +0900361}
Namhyung Kimea251d52012-09-03 11:53:06 +0900362
Jiri Olsa12400052012-10-13 00:06:16 +0200363void perf_hpp__column_register(struct perf_hpp_fmt *format)
364{
365 list_add_tail(&format->list, &perf_hpp__list);
366}
367
368void perf_hpp__column_enable(unsigned col)
Jiri Olsa1d778222012-10-04 21:49:39 +0900369{
370 BUG_ON(col >= PERF_HPP__MAX_INDEX);
Jiri Olsa12400052012-10-13 00:06:16 +0200371 perf_hpp__column_register(&perf_hpp__format[col]);
Namhyung Kimea251d52012-09-03 11:53:06 +0900372}
373
374static inline void advance_hpp(struct perf_hpp *hpp, int inc)
375{
376 hpp->buf += inc;
377 hpp->size -= inc;
378}
379
380int hist_entry__period_snprintf(struct perf_hpp *hpp, struct hist_entry *he,
381 bool color)
382{
383 const char *sep = symbol_conf.field_sep;
Jiri Olsa12400052012-10-13 00:06:16 +0200384 struct perf_hpp_fmt *fmt;
Namhyung Kimea251d52012-09-03 11:53:06 +0900385 char *start = hpp->buf;
Jiri Olsa12400052012-10-13 00:06:16 +0200386 int ret;
Jiri Olsa5395a042012-10-04 21:49:37 +0900387 bool first = true;
Namhyung Kimea251d52012-09-03 11:53:06 +0900388
389 if (symbol_conf.exclude_other && !he->parent)
390 return 0;
391
Jiri Olsa12400052012-10-13 00:06:16 +0200392 perf_hpp__for_each_format(fmt) {
Jiri Olsac0d246b2012-10-20 22:14:10 +0200393 /*
394 * If there's no field_sep, we still need
395 * to display initial ' '.
396 */
Jiri Olsa5395a042012-10-04 21:49:37 +0900397 if (!sep || !first) {
Namhyung Kimea251d52012-09-03 11:53:06 +0900398 ret = scnprintf(hpp->buf, hpp->size, "%s", sep ?: " ");
399 advance_hpp(hpp, ret);
Jiri Olsac0d246b2012-10-20 22:14:10 +0200400 } else
Jiri Olsa5395a042012-10-04 21:49:37 +0900401 first = false;
Namhyung Kimea251d52012-09-03 11:53:06 +0900402
Jiri Olsa12400052012-10-13 00:06:16 +0200403 if (color && fmt->color)
404 ret = fmt->color(hpp, he);
Namhyung Kimea251d52012-09-03 11:53:06 +0900405 else
Jiri Olsa12400052012-10-13 00:06:16 +0200406 ret = fmt->entry(hpp, he);
Namhyung Kimea251d52012-09-03 11:53:06 +0900407
408 advance_hpp(hpp, ret);
409 }
410
411 return hpp->buf - start;
412}
413
414int hist_entry__sort_snprintf(struct hist_entry *he, char *s, size_t size,
415 struct hists *hists)
416{
417 const char *sep = symbol_conf.field_sep;
418 struct sort_entry *se;
419 int ret = 0;
420
421 list_for_each_entry(se, &hist_entry__sort_list, list) {
422 if (se->elide)
423 continue;
424
425 ret += scnprintf(s + ret, size - ret, "%s", sep ?: " ");
426 ret += se->se_snprintf(he, s + ret, size - ret,
427 hists__col_len(hists, se->se_width_idx));
428 }
429
430 return ret;
431}
Namhyung Kim7e62ef42012-09-03 11:53:08 +0900432
433/*
434 * See hists__fprintf to match the column widths
435 */
436unsigned int hists__sort_list_width(struct hists *hists)
437{
Jiri Olsa12400052012-10-13 00:06:16 +0200438 struct perf_hpp_fmt *fmt;
Namhyung Kim7e62ef42012-09-03 11:53:08 +0900439 struct sort_entry *se;
Jiri Olsa12400052012-10-13 00:06:16 +0200440 int i = 0, ret = 0;
Namhyung Kim7e62ef42012-09-03 11:53:08 +0900441
Jiri Olsa12400052012-10-13 00:06:16 +0200442 perf_hpp__for_each_format(fmt) {
Namhyung Kim7e62ef42012-09-03 11:53:08 +0900443 if (i)
444 ret += 2;
445
Jiri Olsa12400052012-10-13 00:06:16 +0200446 ret += fmt->width(NULL);
Namhyung Kim7e62ef42012-09-03 11:53:08 +0900447 }
448
449 list_for_each_entry(se, &hist_entry__sort_list, list)
450 if (!se->elide)
451 ret += 2 + hists__col_len(hists, se->se_width_idx);
452
453 if (verbose) /* Addr + origin */
454 ret += 3 + BITS_PER_LONG / 4;
455
456 return ret;
457}