diff options
author | Namhyung Kim <namhyung.kim@lge.com> | 2013-02-07 04:02:09 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-02-14 12:59:28 -0500 |
commit | 7a60ba948267336d77a48a3539f98151f9dcfba6 (patch) | |
tree | 0b716efb72f40233bf204d2f2061b148d3fd4f5e /tools | |
parent | 2b676bf068916046151277f27113f80828e33001 (diff) |
perf gtk/annotate: Support multiple event annotation
Show multiple annotation result for each evsel. Each result represents
the most frquently sampled symbol/function for the evsel and it will be
shown in a tab window.
For this add a reference to main container (notebook) to the pgctx. At
the first call to annotate browser, hist_entry__find_annotations() will
setup a new browser, and next calls will add new tabs to the browser.
But it requires final perf_gtk__show_annotations() to start processing
GUI events.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Borislav Petkov <bp@alien8.de>
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/1360227734-375-3-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/builtin-annotate.c | 4 | ||||
-rw-r--r-- | tools/perf/ui/gtk/annotate.c | 74 | ||||
-rw-r--r-- | tools/perf/ui/gtk/gtk.h | 1 | ||||
-rw-r--r-- | tools/perf/util/annotate.h | 4 |
4 files changed, 56 insertions, 27 deletions
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c index 9d758c9611a5..68e3a16abd3d 100644 --- a/tools/perf/builtin-annotate.c +++ b/tools/perf/builtin-annotate.c | |||
@@ -227,6 +227,10 @@ static int __cmd_annotate(struct perf_annotate *ann) | |||
227 | ui__error("The %s file has no samples!\n", session->filename); | 227 | ui__error("The %s file has no samples!\n", session->filename); |
228 | goto out_delete; | 228 | goto out_delete; |
229 | } | 229 | } |
230 | |||
231 | if (use_browser == 2) | ||
232 | perf_gtk__show_annotations(); | ||
233 | |||
230 | out_delete: | 234 | out_delete: |
231 | /* | 235 | /* |
232 | * Speed up the exit process, for large files this can | 236 | * Speed up the exit process, for large files this can |
diff --git a/tools/perf/ui/gtk/annotate.c b/tools/perf/ui/gtk/annotate.c index 19d84fa327af..1ce89f2558fa 100644 --- a/tools/perf/ui/gtk/annotate.c +++ b/tools/perf/ui/gtk/annotate.c | |||
@@ -126,31 +126,52 @@ static int perf_gtk__annotate_symbol(GtkWidget *window, struct symbol *sym, | |||
126 | int symbol__gtk_annotate(struct symbol *sym, struct map *map, int evidx, | 126 | int symbol__gtk_annotate(struct symbol *sym, struct map *map, int evidx, |
127 | struct hist_browser_timer *hbt) | 127 | struct hist_browser_timer *hbt) |
128 | { | 128 | { |
129 | GtkWidget *vbox; | ||
130 | GtkWidget *notebook; | ||
131 | GtkWidget *infobar; | ||
132 | GtkWidget *statbar; | ||
133 | GtkWidget *window; | 129 | GtkWidget *window; |
130 | GtkWidget *notebook; | ||
134 | GtkWidget *scrolled_window; | 131 | GtkWidget *scrolled_window; |
135 | GtkWidget *tab_label; | 132 | GtkWidget *tab_label; |
136 | 133 | ||
137 | signal(SIGSEGV, perf_gtk__signal); | 134 | if (perf_gtk__is_active_context(pgctx)) { |
138 | signal(SIGFPE, perf_gtk__signal); | 135 | window = pgctx->main_window; |
139 | signal(SIGINT, perf_gtk__signal); | 136 | notebook = pgctx->notebook; |
140 | signal(SIGQUIT, perf_gtk__signal); | 137 | } else { |
141 | signal(SIGTERM, perf_gtk__signal); | 138 | GtkWidget *vbox; |
139 | GtkWidget *infobar; | ||
140 | GtkWidget *statbar; | ||
142 | 141 | ||
143 | window = gtk_window_new(GTK_WINDOW_TOPLEVEL); | 142 | signal(SIGSEGV, perf_gtk__signal); |
144 | gtk_window_set_title(GTK_WINDOW(window), "perf annotate"); | 143 | signal(SIGFPE, perf_gtk__signal); |
144 | signal(SIGINT, perf_gtk__signal); | ||
145 | signal(SIGQUIT, perf_gtk__signal); | ||
146 | signal(SIGTERM, perf_gtk__signal); | ||
145 | 147 | ||
146 | g_signal_connect(window, "delete_event", gtk_main_quit, NULL); | 148 | window = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
149 | gtk_window_set_title(GTK_WINDOW(window), "perf annotate"); | ||
147 | 150 | ||
148 | pgctx = perf_gtk__activate_context(window); | 151 | g_signal_connect(window, "delete_event", gtk_main_quit, NULL); |
149 | if (!pgctx) | 152 | |
150 | return -1; | 153 | pgctx = perf_gtk__activate_context(window); |
154 | if (!pgctx) | ||
155 | return -1; | ||
156 | |||
157 | vbox = gtk_vbox_new(FALSE, 0); | ||
158 | notebook = gtk_notebook_new(); | ||
159 | pgctx->notebook = notebook; | ||
160 | |||
161 | gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0); | ||
162 | |||
163 | infobar = perf_gtk__setup_info_bar(); | ||
164 | if (infobar) { | ||
165 | gtk_box_pack_start(GTK_BOX(vbox), infobar, | ||
166 | FALSE, FALSE, 0); | ||
167 | } | ||
168 | |||
169 | statbar = perf_gtk__setup_statusbar(); | ||
170 | gtk_box_pack_start(GTK_BOX(vbox), statbar, FALSE, FALSE, 0); | ||
171 | |||
172 | gtk_container_add(GTK_CONTAINER(window), vbox); | ||
173 | } | ||
151 | 174 | ||
152 | vbox = gtk_vbox_new(FALSE, 0); | ||
153 | notebook = gtk_notebook_new(); | ||
154 | scrolled_window = gtk_scrolled_window_new(NULL, NULL); | 175 | scrolled_window = gtk_scrolled_window_new(NULL, NULL); |
155 | tab_label = gtk_label_new(sym->name); | 176 | tab_label = gtk_label_new(sym->name); |
156 | 177 | ||
@@ -160,19 +181,19 @@ int symbol__gtk_annotate(struct symbol *sym, struct map *map, int evidx, | |||
160 | 181 | ||
161 | gtk_notebook_append_page(GTK_NOTEBOOK(notebook), scrolled_window, | 182 | gtk_notebook_append_page(GTK_NOTEBOOK(notebook), scrolled_window, |
162 | tab_label); | 183 | tab_label); |
163 | gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0); | ||
164 | |||
165 | infobar = perf_gtk__setup_info_bar(); | ||
166 | if (infobar) | ||
167 | gtk_box_pack_start(GTK_BOX(vbox), infobar, FALSE, FALSE, 0); | ||
168 | 184 | ||
169 | statbar = perf_gtk__setup_statusbar(); | 185 | perf_gtk__annotate_symbol(scrolled_window, sym, map, evidx, hbt); |
170 | gtk_box_pack_start(GTK_BOX(vbox), statbar, FALSE, FALSE, 0); | 186 | return 0; |
187 | } | ||
171 | 188 | ||
172 | gtk_container_add(GTK_CONTAINER(window), vbox); | 189 | void perf_gtk__show_annotations(void) |
190 | { | ||
191 | GtkWidget *window; | ||
173 | 192 | ||
174 | perf_gtk__annotate_symbol(scrolled_window, sym, map, evidx, hbt); | 193 | if (!perf_gtk__is_active_context(pgctx)) |
194 | return; | ||
175 | 195 | ||
196 | window = pgctx->main_window; | ||
176 | gtk_widget_show_all(window); | 197 | gtk_widget_show_all(window); |
177 | 198 | ||
178 | perf_gtk__resize_window(window); | 199 | perf_gtk__resize_window(window); |
@@ -181,5 +202,4 @@ int symbol__gtk_annotate(struct symbol *sym, struct map *map, int evidx, | |||
181 | gtk_main(); | 202 | gtk_main(); |
182 | 203 | ||
183 | perf_gtk__deactivate_context(&pgctx); | 204 | perf_gtk__deactivate_context(&pgctx); |
184 | return 0; | ||
185 | } | 205 | } |
diff --git a/tools/perf/ui/gtk/gtk.h b/tools/perf/ui/gtk/gtk.h index 5d3693754828..3d96785ef155 100644 --- a/tools/perf/ui/gtk/gtk.h +++ b/tools/perf/ui/gtk/gtk.h | |||
@@ -10,6 +10,7 @@ | |||
10 | 10 | ||
11 | struct perf_gtk_context { | 11 | struct perf_gtk_context { |
12 | GtkWidget *main_window; | 12 | GtkWidget *main_window; |
13 | GtkWidget *notebook; | ||
13 | 14 | ||
14 | #ifdef HAVE_GTK_INFO_BAR | 15 | #ifdef HAVE_GTK_INFO_BAR |
15 | GtkWidget *info_bar; | 16 | GtkWidget *info_bar; |
diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h index a8ccbda4aeb7..c422440fe611 100644 --- a/tools/perf/util/annotate.h +++ b/tools/perf/util/annotate.h | |||
@@ -164,6 +164,8 @@ static inline int hist_entry__gtk_annotate(struct hist_entry *he, int evidx, | |||
164 | { | 164 | { |
165 | return symbol__gtk_annotate(he->ms.sym, he->ms.map, evidx, hbt); | 165 | return symbol__gtk_annotate(he->ms.sym, he->ms.map, evidx, hbt); |
166 | } | 166 | } |
167 | |||
168 | void perf_gtk__show_annotations(void); | ||
167 | #else | 169 | #else |
168 | static inline int hist_entry__gtk_annotate(struct hist_entry *he __maybe_unused, | 170 | static inline int hist_entry__gtk_annotate(struct hist_entry *he __maybe_unused, |
169 | int evidx __maybe_unused, | 171 | int evidx __maybe_unused, |
@@ -172,6 +174,8 @@ static inline int hist_entry__gtk_annotate(struct hist_entry *he __maybe_unused, | |||
172 | { | 174 | { |
173 | return 0; | 175 | return 0; |
174 | } | 176 | } |
177 | |||
178 | static inline void perf_gtk__show_annotations(void) {} | ||
175 | #endif | 179 | #endif |
176 | 180 | ||
177 | extern const char *disassembler_style; | 181 | extern const char *disassembler_style; |