diff options
author | Namhyung Kim <namhyung.kim@lge.com> | 2013-01-22 04:09:40 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-01-31 11:07:47 -0500 |
commit | cb16008bcc6ea53617ca06c9eb4ab0ecafe04585 (patch) | |
tree | e3defa5f512df759eb68ad375432ae284d8959a1 /tools | |
parent | 371d8c402e8c3562e913c7fda95094f42fbcf0ef (diff) |
perf gtk/browser: Add support for event group view
Show group members's overhead also when showing 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: Pekka Enberg <penberg@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranina@google.com>
Link: http://lkml.kernel.org/r/1358845787-1350-13-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/ui/gtk/hists.c | 56 |
1 files changed, 52 insertions, 4 deletions
diff --git a/tools/perf/ui/gtk/hists.c b/tools/perf/ui/gtk/hists.c index 38be79d4b5c6..c87a98c7efaa 100644 --- a/tools/perf/ui/gtk/hists.c +++ b/tools/perf/ui/gtk/hists.c | |||
@@ -8,8 +8,7 @@ | |||
8 | 8 | ||
9 | #define MAX_COLUMNS 32 | 9 | #define MAX_COLUMNS 32 |
10 | 10 | ||
11 | static int perf_gtk__percent_color_snprintf(char *buf, size_t size, | 11 | static int __percent_color_snprintf(char *buf, size_t size, double percent) |
12 | double percent) | ||
13 | { | 12 | { |
14 | int ret = 0; | 13 | int ret = 0; |
15 | const char *markup; | 14 | const char *markup; |
@@ -18,7 +17,7 @@ static int perf_gtk__percent_color_snprintf(char *buf, size_t size, | |||
18 | if (markup) | 17 | if (markup) |
19 | ret += scnprintf(buf, size, markup); | 18 | ret += scnprintf(buf, size, markup); |
20 | 19 | ||
21 | ret += scnprintf(buf + ret, size - ret, "%6.2f%%", percent); | 20 | ret += scnprintf(buf + ret, size - ret, " %6.2f%%", percent); |
22 | 21 | ||
23 | if (markup) | 22 | if (markup) |
24 | ret += scnprintf(buf + ret, size - ret, "</span>"); | 23 | ret += scnprintf(buf + ret, size - ret, "</span>"); |
@@ -37,7 +36,55 @@ static int __hpp__color_fmt(struct perf_hpp *hpp, struct hist_entry *he, | |||
37 | if (hists->stats.total_period) | 36 | if (hists->stats.total_period) |
38 | percent = 100.0 * get_field(he) / hists->stats.total_period; | 37 | percent = 100.0 * get_field(he) / hists->stats.total_period; |
39 | 38 | ||
40 | ret = perf_gtk__percent_color_snprintf(hpp->buf, hpp->size, percent); | 39 | ret = __percent_color_snprintf(hpp->buf, hpp->size, percent); |
40 | |||
41 | if (symbol_conf.event_group) { | ||
42 | int prev_idx, idx_delta; | ||
43 | struct perf_evsel *evsel = hists_to_evsel(hists); | ||
44 | struct hist_entry *pair; | ||
45 | int nr_members = evsel->nr_members; | ||
46 | |||
47 | if (nr_members <= 1) | ||
48 | return ret; | ||
49 | |||
50 | prev_idx = perf_evsel__group_idx(evsel); | ||
51 | |||
52 | list_for_each_entry(pair, &he->pairs.head, pairs.node) { | ||
53 | u64 period = get_field(pair); | ||
54 | u64 total = pair->hists->stats.total_period; | ||
55 | |||
56 | evsel = hists_to_evsel(pair->hists); | ||
57 | idx_delta = perf_evsel__group_idx(evsel) - prev_idx - 1; | ||
58 | |||
59 | while (idx_delta--) { | ||
60 | /* | ||
61 | * zero-fill group members in the middle which | ||
62 | * have no sample | ||
63 | */ | ||
64 | ret += __percent_color_snprintf(hpp->buf + ret, | ||
65 | hpp->size - ret, | ||
66 | 0.0); | ||
67 | } | ||
68 | |||
69 | percent = 100.0 * period / total; | ||
70 | ret += __percent_color_snprintf(hpp->buf + ret, | ||
71 | hpp->size - ret, | ||
72 | percent); | ||
73 | |||
74 | prev_idx = perf_evsel__group_idx(evsel); | ||
75 | } | ||
76 | |||
77 | idx_delta = nr_members - prev_idx - 1; | ||
78 | |||
79 | while (idx_delta--) { | ||
80 | /* | ||
81 | * zero-fill group members at last which have no sample | ||
82 | */ | ||
83 | ret += __percent_color_snprintf(hpp->buf + ret, | ||
84 | hpp->size - ret, | ||
85 | 0.0); | ||
86 | } | ||
87 | } | ||
41 | return ret; | 88 | return ret; |
42 | } | 89 | } |
43 | 90 | ||
@@ -96,6 +143,7 @@ static void perf_gtk__show_hists(GtkWidget *window, struct hists *hists) | |||
96 | struct perf_hpp hpp = { | 143 | struct perf_hpp hpp = { |
97 | .buf = s, | 144 | .buf = s, |
98 | .size = sizeof(s), | 145 | .size = sizeof(s), |
146 | .ptr = hists_to_evsel(hists), | ||
99 | }; | 147 | }; |
100 | 148 | ||
101 | nr_cols = 0; | 149 | nr_cols = 0; |