diff options
Diffstat (limited to 'tools/perf/ui/gtk')
-rw-r--r-- | tools/perf/ui/gtk/annotate.c | 26 | ||||
-rw-r--r-- | tools/perf/ui/gtk/hists.c | 7 |
2 files changed, 23 insertions, 10 deletions
diff --git a/tools/perf/ui/gtk/annotate.c b/tools/perf/ui/gtk/annotate.c index 7d8dc581a545..f538794615db 100644 --- a/tools/perf/ui/gtk/annotate.c +++ b/tools/perf/ui/gtk/annotate.c | |||
@@ -1,6 +1,7 @@ | |||
1 | #include "gtk.h" | 1 | #include "gtk.h" |
2 | #include "util/debug.h" | 2 | #include "util/debug.h" |
3 | #include "util/annotate.h" | 3 | #include "util/annotate.h" |
4 | #include "util/evsel.h" | ||
4 | #include "ui/helpline.h" | 5 | #include "ui/helpline.h" |
5 | 6 | ||
6 | 7 | ||
@@ -32,7 +33,7 @@ static int perf_gtk__get_percent(char *buf, size_t size, struct symbol *sym, | |||
32 | return 0; | 33 | return 0; |
33 | 34 | ||
34 | symhist = annotation__histogram(symbol__annotation(sym), evidx); | 35 | symhist = annotation__histogram(symbol__annotation(sym), evidx); |
35 | if (!symhist->addr[dl->offset]) | 36 | if (!symbol_conf.event_group && !symhist->addr[dl->offset]) |
36 | return 0; | 37 | return 0; |
37 | 38 | ||
38 | percent = 100.0 * symhist->addr[dl->offset] / symhist->sum; | 39 | percent = 100.0 * symhist->addr[dl->offset] / symhist->sum; |
@@ -85,7 +86,7 @@ static int perf_gtk__get_line(char *buf, size_t size, struct disasm_line *dl) | |||
85 | } | 86 | } |
86 | 87 | ||
87 | static int perf_gtk__annotate_symbol(GtkWidget *window, struct symbol *sym, | 88 | static int perf_gtk__annotate_symbol(GtkWidget *window, struct symbol *sym, |
88 | struct map *map, int evidx, | 89 | struct map *map, struct perf_evsel *evsel, |
89 | struct hist_browser_timer *hbt __maybe_unused) | 90 | struct hist_browser_timer *hbt __maybe_unused) |
90 | { | 91 | { |
91 | struct disasm_line *pos, *n; | 92 | struct disasm_line *pos, *n; |
@@ -118,10 +119,24 @@ static int perf_gtk__annotate_symbol(GtkWidget *window, struct symbol *sym, | |||
118 | 119 | ||
119 | list_for_each_entry(pos, ¬es->src->source, node) { | 120 | list_for_each_entry(pos, ¬es->src->source, node) { |
120 | GtkTreeIter iter; | 121 | GtkTreeIter iter; |
122 | int ret = 0; | ||
121 | 123 | ||
122 | gtk_list_store_append(store, &iter); | 124 | gtk_list_store_append(store, &iter); |
123 | 125 | ||
124 | if (perf_gtk__get_percent(s, sizeof(s), sym, pos, evidx)) | 126 | if (perf_evsel__is_group_event(evsel)) { |
127 | for (i = 0; i < evsel->nr_members; i++) { | ||
128 | ret += perf_gtk__get_percent(s + ret, | ||
129 | sizeof(s) - ret, | ||
130 | sym, pos, | ||
131 | evsel->idx + i); | ||
132 | ret += scnprintf(s + ret, sizeof(s) - ret, " "); | ||
133 | } | ||
134 | } else { | ||
135 | ret = perf_gtk__get_percent(s, sizeof(s), sym, pos, | ||
136 | evsel->idx); | ||
137 | } | ||
138 | |||
139 | if (ret) | ||
125 | gtk_list_store_set(store, &iter, ANN_COL__PERCENT, s, -1); | 140 | gtk_list_store_set(store, &iter, ANN_COL__PERCENT, s, -1); |
126 | if (perf_gtk__get_offset(s, sizeof(s), sym, map, pos)) | 141 | if (perf_gtk__get_offset(s, sizeof(s), sym, map, pos)) |
127 | gtk_list_store_set(store, &iter, ANN_COL__OFFSET, s, -1); | 142 | gtk_list_store_set(store, &iter, ANN_COL__OFFSET, s, -1); |
@@ -139,7 +154,8 @@ static int perf_gtk__annotate_symbol(GtkWidget *window, struct symbol *sym, | |||
139 | return 0; | 154 | return 0; |
140 | } | 155 | } |
141 | 156 | ||
142 | int symbol__gtk_annotate(struct symbol *sym, struct map *map, int evidx, | 157 | int symbol__gtk_annotate(struct symbol *sym, struct map *map, |
158 | struct perf_evsel *evsel, | ||
143 | struct hist_browser_timer *hbt) | 159 | struct hist_browser_timer *hbt) |
144 | { | 160 | { |
145 | GtkWidget *window; | 161 | GtkWidget *window; |
@@ -206,7 +222,7 @@ int symbol__gtk_annotate(struct symbol *sym, struct map *map, int evidx, | |||
206 | gtk_notebook_append_page(GTK_NOTEBOOK(notebook), scrolled_window, | 222 | gtk_notebook_append_page(GTK_NOTEBOOK(notebook), scrolled_window, |
207 | tab_label); | 223 | tab_label); |
208 | 224 | ||
209 | perf_gtk__annotate_symbol(scrolled_window, sym, map, evidx, hbt); | 225 | perf_gtk__annotate_symbol(scrolled_window, sym, map, evsel, hbt); |
210 | return 0; | 226 | return 0; |
211 | } | 227 | } |
212 | 228 | ||
diff --git a/tools/perf/ui/gtk/hists.c b/tools/perf/ui/gtk/hists.c index 1e764a8ad259..6f259b3d14e2 100644 --- a/tools/perf/ui/gtk/hists.c +++ b/tools/perf/ui/gtk/hists.c | |||
@@ -32,21 +32,18 @@ static int __hpp__color_fmt(struct perf_hpp *hpp, struct hist_entry *he, | |||
32 | int ret; | 32 | int ret; |
33 | double percent = 0.0; | 33 | double percent = 0.0; |
34 | struct hists *hists = he->hists; | 34 | struct hists *hists = he->hists; |
35 | struct perf_evsel *evsel = hists_to_evsel(hists); | ||
35 | 36 | ||
36 | if (hists->stats.total_period) | 37 | if (hists->stats.total_period) |
37 | percent = 100.0 * get_field(he) / hists->stats.total_period; | 38 | percent = 100.0 * get_field(he) / hists->stats.total_period; |
38 | 39 | ||
39 | ret = __percent_color_snprintf(hpp->buf, hpp->size, percent); | 40 | ret = __percent_color_snprintf(hpp->buf, hpp->size, percent); |
40 | 41 | ||
41 | if (symbol_conf.event_group) { | 42 | if (perf_evsel__is_group_event(evsel)) { |
42 | int prev_idx, idx_delta; | 43 | int prev_idx, idx_delta; |
43 | struct perf_evsel *evsel = hists_to_evsel(hists); | ||
44 | struct hist_entry *pair; | 44 | struct hist_entry *pair; |
45 | int nr_members = evsel->nr_members; | 45 | int nr_members = evsel->nr_members; |
46 | 46 | ||
47 | if (nr_members <= 1) | ||
48 | return ret; | ||
49 | |||
50 | prev_idx = perf_evsel__group_idx(evsel); | 47 | prev_idx = perf_evsel__group_idx(evsel); |
51 | 48 | ||
52 | list_for_each_entry(pair, &he->pairs.head, pairs.node) { | 49 | list_for_each_entry(pair, &he->pairs.head, pairs.node) { |