Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) // SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) #include "gtk.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3) #include "util/sort.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) #include "util/debug.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) #include "util/annotate.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) #include "util/evsel.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) #include "util/map.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #include "util/dso.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #include "util/symbol.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #include "ui/helpline.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #include <inttypes.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #include <signal.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) 	ANN_COL__PERCENT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) 	ANN_COL__OFFSET,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) 	ANN_COL__LINE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) 	MAX_ANN_COLS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) static const char *const col_names[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 	"Overhead",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 	"Offset",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 	"Line"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) static int perf_gtk__get_percent(char *buf, size_t size, struct symbol *sym,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 				 struct disasm_line *dl, int evidx)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 	struct sym_hist *symhist;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 	double percent = 0.0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 	const char *markup;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 	int ret = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 	strcpy(buf, "");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 	if (dl->al.offset == (s64) -1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 	symhist = annotation__histogram(symbol__annotation(sym), evidx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 	if (!symbol_conf.event_group && !symhist->addr[dl->al.offset].nr_samples)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 	percent = 100.0 * symhist->addr[dl->al.offset].nr_samples / symhist->nr_samples;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	markup = perf_gtk__get_percent_color(percent);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	if (markup)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 		ret += scnprintf(buf, size, "%s", markup);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	ret += scnprintf(buf + ret, size - ret, "%6.2f%%", percent);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	if (markup)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 		ret += scnprintf(buf + ret, size - ret, "</span>");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) static int perf_gtk__get_offset(char *buf, size_t size, struct map_symbol *ms,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 				struct disasm_line *dl)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	u64 start = map__rip_2objdump(ms->map, ms->sym->start);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	strcpy(buf, "");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	if (dl->al.offset == (s64) -1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	return scnprintf(buf, size, "%"PRIx64, start + dl->al.offset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) static int perf_gtk__get_line(char *buf, size_t size, struct disasm_line *dl)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	int ret = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	char *line = g_markup_escape_text(dl->al.line, -1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	const char *markup = "<span fgcolor='gray'>";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	strcpy(buf, "");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	if (!line)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 	if (dl->al.offset != (s64) -1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 		markup = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	if (markup)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 		ret += scnprintf(buf, size, "%s", markup);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	ret += scnprintf(buf + ret, size - ret, "%s", line);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	if (markup)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 		ret += scnprintf(buf + ret, size - ret, "</span>");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	g_free(line);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) static int perf_gtk__annotate_symbol(GtkWidget *window, struct map_symbol *ms,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 				struct evsel *evsel,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 				struct hist_browser_timer *hbt __maybe_unused)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	struct symbol *sym = ms->sym;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	struct disasm_line *pos, *n;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	struct annotation *notes;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	GType col_types[MAX_ANN_COLS];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	GtkCellRenderer *renderer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	GtkListStore *store;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	GtkWidget *view;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 	int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	char s[512];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	notes = symbol__annotation(sym);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	for (i = 0; i < MAX_ANN_COLS; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 		col_types[i] = G_TYPE_STRING;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	store = gtk_list_store_newv(MAX_ANN_COLS, col_types);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	view = gtk_tree_view_new();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	renderer = gtk_cell_renderer_text_new();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 	for (i = 0; i < MAX_ANN_COLS; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 		gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(view),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 					-1, col_names[i], renderer, "markup",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 					i, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 	gtk_tree_view_set_model(GTK_TREE_VIEW(view), GTK_TREE_MODEL(store));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 	g_object_unref(GTK_TREE_MODEL(store));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 	list_for_each_entry(pos, &notes->src->source, al.node) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 		GtkTreeIter iter;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 		int ret = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 		gtk_list_store_append(store, &iter);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 		if (evsel__is_group_event(evsel)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 			for (i = 0; i < evsel->core.nr_members; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 				ret += perf_gtk__get_percent(s + ret,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 							     sizeof(s) - ret,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 							     sym, pos,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 							     evsel->idx + i);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 				ret += scnprintf(s + ret, sizeof(s) - ret, " ");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 		} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 			ret = perf_gtk__get_percent(s, sizeof(s), sym, pos,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 						    evsel->idx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 		if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 			gtk_list_store_set(store, &iter, ANN_COL__PERCENT, s, -1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 		if (perf_gtk__get_offset(s, sizeof(s), ms, pos))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 			gtk_list_store_set(store, &iter, ANN_COL__OFFSET, s, -1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 		if (perf_gtk__get_line(s, sizeof(s), pos))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 			gtk_list_store_set(store, &iter, ANN_COL__LINE, s, -1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 	gtk_container_add(GTK_CONTAINER(window), view);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 	list_for_each_entry_safe(pos, n, &notes->src->source, al.node) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 		list_del_init(&pos->al.node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 		disasm_line__free(pos);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) static int symbol__gtk_annotate(struct map_symbol *ms, struct evsel *evsel,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 				struct hist_browser_timer *hbt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 	struct symbol *sym = ms->sym;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 	GtkWidget *window;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 	GtkWidget *notebook;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 	GtkWidget *scrolled_window;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 	GtkWidget *tab_label;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 	int err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 	if (ms->map->dso->annotate_warned)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 		return -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 	err = symbol__annotate(ms, evsel, &annotation__default_options, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 	if (err) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 		char msg[BUFSIZ];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 		symbol__strerror_disassemble(ms, err, msg, sizeof(msg));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 		ui__error("Couldn't annotate %s: %s\n", sym->name, msg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 		return -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 	symbol__calc_percent(sym, evsel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 	if (perf_gtk__is_active_context(pgctx)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 		window = pgctx->main_window;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 		notebook = pgctx->notebook;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 	} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 		GtkWidget *vbox;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 		GtkWidget *infobar;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 		GtkWidget *statbar;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 		signal(SIGSEGV, perf_gtk__signal);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 		signal(SIGFPE,  perf_gtk__signal);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 		signal(SIGINT,  perf_gtk__signal);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 		signal(SIGQUIT, perf_gtk__signal);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 		signal(SIGTERM, perf_gtk__signal);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 		window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 		gtk_window_set_title(GTK_WINDOW(window), "perf annotate");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 		g_signal_connect(window, "delete_event", gtk_main_quit, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 		pgctx = perf_gtk__activate_context(window);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 		if (!pgctx)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 			return -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 		vbox = gtk_vbox_new(FALSE, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 		notebook = gtk_notebook_new();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 		pgctx->notebook = notebook;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 		gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 		infobar = perf_gtk__setup_info_bar();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 		if (infobar) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 			gtk_box_pack_start(GTK_BOX(vbox), infobar,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 					   FALSE, FALSE, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 		statbar = perf_gtk__setup_statusbar();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 		gtk_box_pack_start(GTK_BOX(vbox), statbar, FALSE, FALSE, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 		gtk_container_add(GTK_CONTAINER(window), vbox);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 	scrolled_window = gtk_scrolled_window_new(NULL, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 	tab_label = gtk_label_new(sym->name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 				       GTK_POLICY_AUTOMATIC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 				       GTK_POLICY_AUTOMATIC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 	gtk_notebook_append_page(GTK_NOTEBOOK(notebook), scrolled_window,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 				 tab_label);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 	perf_gtk__annotate_symbol(scrolled_window, ms, evsel, hbt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) int hist_entry__gtk_annotate(struct hist_entry *he,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) 			     struct evsel *evsel,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) 			     struct hist_browser_timer *hbt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 	return symbol__gtk_annotate(&he->ms, evsel, hbt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) void perf_gtk__show_annotations(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) 	GtkWidget *window;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) 	if (!perf_gtk__is_active_context(pgctx))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) 	window = pgctx->main_window;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) 	gtk_widget_show_all(window);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) 	perf_gtk__resize_window(window);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) 	gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) 	gtk_main();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) 	perf_gtk__deactivate_context(&pgctx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) }