diff options
author | Namhyung Kim <namhyung.kim@lge.com> | 2013-06-04 05:22:14 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-07-12 12:52:40 -0400 |
commit | cc60f24e225e50a0b57398f9ba105fd8ffcf4bb3 (patch) | |
tree | edeb9620b97328f1b5190655b3d7e34e20ca67f0 /tools/perf/ui | |
parent | 2bbc5874251830fee170a0fc97fa5788717d2fd9 (diff) |
perf gtk/hists: Display callchain overhead also
Display callchain percent value in the overhead column.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Reviewed-by: Pekka Enberg <penberg@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
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>
Link: http://lkml.kernel.org/r/1370337737-30812-4-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/ui')
-rw-r--r-- | tools/perf/ui/gtk/hists.c | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/tools/perf/ui/gtk/hists.c b/tools/perf/ui/gtk/hists.c index 226c7e10f3cc..fa9f8a09233e 100644 --- a/tools/perf/ui/gtk/hists.c +++ b/tools/perf/ui/gtk/hists.c | |||
@@ -134,7 +134,7 @@ static void callchain_list__sym_name(struct callchain_list *cl, | |||
134 | } | 134 | } |
135 | 135 | ||
136 | static void perf_gtk__add_callchain(struct rb_root *root, GtkTreeStore *store, | 136 | static void perf_gtk__add_callchain(struct rb_root *root, GtkTreeStore *store, |
137 | GtkTreeIter *parent, int col) | 137 | GtkTreeIter *parent, int col, u64 total) |
138 | { | 138 | { |
139 | struct rb_node *nd; | 139 | struct rb_node *nd; |
140 | bool has_single_node = (rb_first(root) == rb_last(root)); | 140 | bool has_single_node = (rb_first(root) == rb_last(root)); |
@@ -144,9 +144,14 @@ static void perf_gtk__add_callchain(struct rb_root *root, GtkTreeStore *store, | |||
144 | struct callchain_list *chain; | 144 | struct callchain_list *chain; |
145 | GtkTreeIter iter, new_parent; | 145 | GtkTreeIter iter, new_parent; |
146 | bool need_new_parent; | 146 | bool need_new_parent; |
147 | double percent; | ||
148 | u64 hits, child_total; | ||
147 | 149 | ||
148 | node = rb_entry(nd, struct callchain_node, rb_node); | 150 | node = rb_entry(nd, struct callchain_node, rb_node); |
149 | 151 | ||
152 | hits = callchain_cumul_hits(node); | ||
153 | percent = 100.0 * hits / total; | ||
154 | |||
150 | new_parent = *parent; | 155 | new_parent = *parent; |
151 | need_new_parent = !has_single_node && (node->val_nr > 1); | 156 | need_new_parent = !has_single_node && (node->val_nr > 1); |
152 | 157 | ||
@@ -155,6 +160,9 @@ static void perf_gtk__add_callchain(struct rb_root *root, GtkTreeStore *store, | |||
155 | 160 | ||
156 | gtk_tree_store_append(store, &iter, &new_parent); | 161 | gtk_tree_store_append(store, &iter, &new_parent); |
157 | 162 | ||
163 | scnprintf(buf, sizeof(buf), "%5.2f%%", percent); | ||
164 | gtk_tree_store_set(store, &iter, 0, buf, -1); | ||
165 | |||
158 | callchain_list__sym_name(chain, buf, sizeof(buf)); | 166 | callchain_list__sym_name(chain, buf, sizeof(buf)); |
159 | gtk_tree_store_set(store, &iter, col, buf, -1); | 167 | gtk_tree_store_set(store, &iter, col, buf, -1); |
160 | 168 | ||
@@ -168,8 +176,14 @@ static void perf_gtk__add_callchain(struct rb_root *root, GtkTreeStore *store, | |||
168 | } | 176 | } |
169 | } | 177 | } |
170 | 178 | ||
179 | if (callchain_param.mode == CHAIN_GRAPH_REL) | ||
180 | child_total = node->children_hit; | ||
181 | else | ||
182 | child_total = total; | ||
183 | |||
171 | /* Now 'iter' contains info of the last callchain_list */ | 184 | /* Now 'iter' contains info of the last callchain_list */ |
172 | perf_gtk__add_callchain(&node->rb_root, store, &iter, col); | 185 | perf_gtk__add_callchain(&node->rb_root, store, &iter, col, |
186 | child_total); | ||
173 | } | 187 | } |
174 | } | 188 | } |
175 | 189 | ||
@@ -283,8 +297,15 @@ static void perf_gtk__show_hists(GtkWidget *window, struct hists *hists, | |||
283 | } | 297 | } |
284 | 298 | ||
285 | if (symbol_conf.use_callchain && sort__has_sym) { | 299 | if (symbol_conf.use_callchain && sort__has_sym) { |
300 | u64 total; | ||
301 | |||
302 | if (callchain_param.mode == CHAIN_GRAPH_REL) | ||
303 | total = h->stat.period; | ||
304 | else | ||
305 | total = hists->stats.total_period; | ||
306 | |||
286 | perf_gtk__add_callchain(&h->sorted_chain, store, &iter, | 307 | perf_gtk__add_callchain(&h->sorted_chain, store, &iter, |
287 | sym_col); | 308 | sym_col, total); |
288 | } | 309 | } |
289 | } | 310 | } |
290 | 311 | ||