aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung.kim@lge.com>2013-01-22 04:09:37 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2013-01-31 11:07:46 -0500
commit5b9e2146ec4f8c6d436f9f7043a0409a4296a705 (patch)
tree9da31dd714f40246f085a7b98d8225ee84a772a0
parent843985e953ddcc3d57a62641b377c8d3222859e2 (diff)
perf ui/hist: Add support for event group view
Show group member's overhead also when showing the leader's if event group is enabled. Signed-off-by: Namhyung Kim <namhyung@kernel.org> Cc: Ingo Molnar <mingo@kernel.org> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/r/1358845787-1350-10-git-send-email-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r--tools/perf/ui/hist.c62
-rw-r--r--tools/perf/ui/stdio/hist.c2
2 files changed, 63 insertions, 1 deletions
diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index 849c40028e7b..a47ce98c2cb1 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -21,6 +21,53 @@ static int __hpp__percent_fmt(struct perf_hpp *hpp, struct hist_entry *he,
21 percent = 100.0 * get_field(he) / hists->stats.total_period; 21 percent = 100.0 * get_field(he) / hists->stats.total_period;
22 22
23 ret = print_fn(hpp->buf, hpp->size, fmt, percent); 23 ret = print_fn(hpp->buf, hpp->size, fmt, percent);
24
25 if (symbol_conf.event_group) {
26 int prev_idx, idx_delta;
27 struct perf_evsel *evsel = hists_to_evsel(hists);
28 struct hist_entry *pair;
29 int nr_members = evsel->nr_members;
30
31 if (nr_members <= 1)
32 return ret;
33
34 prev_idx = perf_evsel__group_idx(evsel);
35
36 list_for_each_entry(pair, &he->pairs.head, pairs.node) {
37 u64 period = get_field(pair);
38 u64 total = pair->hists->stats.total_period;
39
40 if (!total)
41 continue;
42
43 evsel = hists_to_evsel(pair->hists);
44 idx_delta = perf_evsel__group_idx(evsel) - prev_idx - 1;
45
46 while (idx_delta--) {
47 /*
48 * zero-fill group members in the middle which
49 * have no sample
50 */
51 ret += print_fn(hpp->buf + ret, hpp->size - ret,
52 fmt, 0.0);
53 }
54
55 ret += print_fn(hpp->buf + ret, hpp->size - ret,
56 fmt, 100.0 * period / total);
57
58 prev_idx = perf_evsel__group_idx(evsel);
59 }
60
61 idx_delta = nr_members - prev_idx - 1;
62
63 while (idx_delta--) {
64 /*
65 * zero-fill group members at last which have no sample
66 */
67 ret += print_fn(hpp->buf + ret, hpp->size - ret,
68 fmt, 0.0);
69 }
70 }
24 return ret; 71 return ret;
25} 72}
26 73
@@ -40,6 +87,11 @@ static int hpp__header_##_type(struct perf_hpp *hpp) \
40{ \ 87{ \
41 int len = _min_width; \ 88 int len = _min_width; \
42 \ 89 \
90 if (symbol_conf.event_group) { \
91 struct perf_evsel *evsel = hpp->ptr; \
92 \
93 len = max(len, evsel->nr_members * _unit_width); \
94 } \
43 return scnprintf(hpp->buf, hpp->size, "%*s", len, _str); \ 95 return scnprintf(hpp->buf, hpp->size, "%*s", len, _str); \
44} 96}
45 97
@@ -48,6 +100,11 @@ static int hpp__width_##_type(struct perf_hpp *hpp __maybe_unused) \
48{ \ 100{ \
49 int len = _min_width; \ 101 int len = _min_width; \
50 \ 102 \
103 if (symbol_conf.event_group) { \
104 struct perf_evsel *evsel = hpp->ptr; \
105 \
106 len = max(len, evsel->nr_members * _unit_width); \
107 } \
51 return len; \ 108 return len; \
52} 109}
53 110
@@ -438,12 +495,15 @@ unsigned int hists__sort_list_width(struct hists *hists)
438 struct perf_hpp_fmt *fmt; 495 struct perf_hpp_fmt *fmt;
439 struct sort_entry *se; 496 struct sort_entry *se;
440 int i = 0, ret = 0; 497 int i = 0, ret = 0;
498 struct perf_hpp dummy_hpp = {
499 .ptr = hists_to_evsel(hists),
500 };
441 501
442 perf_hpp__for_each_format(fmt) { 502 perf_hpp__for_each_format(fmt) {
443 if (i) 503 if (i)
444 ret += 2; 504 ret += 2;
445 505
446 ret += fmt->width(NULL); 506 ret += fmt->width(&dummy_hpp);
447 } 507 }
448 508
449 list_for_each_entry(se, &hist_entry__sort_list, list) 509 list_for_each_entry(se, &hist_entry__sort_list, list)
diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c
index f9798298e3e0..ff1f60cf442e 100644
--- a/tools/perf/ui/stdio/hist.c
+++ b/tools/perf/ui/stdio/hist.c
@@ -3,6 +3,7 @@
3#include "../../util/util.h" 3#include "../../util/util.h"
4#include "../../util/hist.h" 4#include "../../util/hist.h"
5#include "../../util/sort.h" 5#include "../../util/sort.h"
6#include "../../util/evsel.h"
6 7
7 8
8static size_t callchain__fprintf_left_margin(FILE *fp, int left_margin) 9static size_t callchain__fprintf_left_margin(FILE *fp, int left_margin)
@@ -347,6 +348,7 @@ size_t hists__fprintf(struct hists *hists, bool show_header, int max_rows,
347 struct perf_hpp dummy_hpp = { 348 struct perf_hpp dummy_hpp = {
348 .buf = bf, 349 .buf = bf,
349 .size = sizeof(bf), 350 .size = sizeof(bf),
351 .ptr = hists_to_evsel(hists),
350 }; 352 };
351 bool first = true; 353 bool first = true;
352 354