hists.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682
  1. // SPDX-License-Identifier: GPL-2.0
  2. #include "../evlist.h"
  3. #include "../cache.h"
  4. #include "../evsel.h"
  5. #include "../sort.h"
  6. #include "../hist.h"
  7. #include "../helpline.h"
  8. #include "../string2.h"
  9. #include "gtk.h"
  10. #include <signal.h>
  11. #define MAX_COLUMNS 32
  12. static int __percent_color_snprintf(struct perf_hpp *hpp, const char *fmt, ...)
  13. {
  14. int ret = 0;
  15. int len;
  16. va_list args;
  17. double percent;
  18. const char *markup;
  19. char *buf = hpp->buf;
  20. size_t size = hpp->size;
  21. va_start(args, fmt);
  22. len = va_arg(args, int);
  23. percent = va_arg(args, double);
  24. va_end(args);
  25. markup = perf_gtk__get_percent_color(percent);
  26. if (markup)
  27. ret += scnprintf(buf, size, markup);
  28. ret += scnprintf(buf + ret, size - ret, fmt, len, percent);
  29. if (markup)
  30. ret += scnprintf(buf + ret, size - ret, "</span>");
  31. return ret;
  32. }
  33. #define __HPP_COLOR_PERCENT_FN(_type, _field) \
  34. static u64 he_get_##_field(struct hist_entry *he) \
  35. { \
  36. return he->stat._field; \
  37. } \
  38. \
  39. static int perf_gtk__hpp_color_##_type(struct perf_hpp_fmt *fmt, \
  40. struct perf_hpp *hpp, \
  41. struct hist_entry *he) \
  42. { \
  43. return hpp__fmt(fmt, hpp, he, he_get_##_field, " %*.2f%%", \
  44. __percent_color_snprintf, true); \
  45. }
  46. #define __HPP_COLOR_ACC_PERCENT_FN(_type, _field) \
  47. static u64 he_get_acc_##_field(struct hist_entry *he) \
  48. { \
  49. return he->stat_acc->_field; \
  50. } \
  51. \
  52. static int perf_gtk__hpp_color_##_type(struct perf_hpp_fmt *fmt, \
  53. struct perf_hpp *hpp, \
  54. struct hist_entry *he) \
  55. { \
  56. return hpp__fmt_acc(fmt, hpp, he, he_get_acc_##_field, " %*.2f%%", \
  57. __percent_color_snprintf, true); \
  58. }
  59. __HPP_COLOR_PERCENT_FN(overhead, period)
  60. __HPP_COLOR_PERCENT_FN(overhead_sys, period_sys)
  61. __HPP_COLOR_PERCENT_FN(overhead_us, period_us)
  62. __HPP_COLOR_PERCENT_FN(overhead_guest_sys, period_guest_sys)
  63. __HPP_COLOR_PERCENT_FN(overhead_guest_us, period_guest_us)
  64. __HPP_COLOR_ACC_PERCENT_FN(overhead_acc, period)
  65. #undef __HPP_COLOR_PERCENT_FN
  66. void perf_gtk__init_hpp(void)
  67. {
  68. perf_hpp__format[PERF_HPP__OVERHEAD].color =
  69. perf_gtk__hpp_color_overhead;
  70. perf_hpp__format[PERF_HPP__OVERHEAD_SYS].color =
  71. perf_gtk__hpp_color_overhead_sys;
  72. perf_hpp__format[PERF_HPP__OVERHEAD_US].color =
  73. perf_gtk__hpp_color_overhead_us;
  74. perf_hpp__format[PERF_HPP__OVERHEAD_GUEST_SYS].color =
  75. perf_gtk__hpp_color_overhead_guest_sys;
  76. perf_hpp__format[PERF_HPP__OVERHEAD_GUEST_US].color =
  77. perf_gtk__hpp_color_overhead_guest_us;
  78. perf_hpp__format[PERF_HPP__OVERHEAD_ACC].color =
  79. perf_gtk__hpp_color_overhead_acc;
  80. }
  81. static void perf_gtk__add_callchain_flat(struct rb_root *root, GtkTreeStore *store,
  82. GtkTreeIter *parent, int col, u64 total)
  83. {
  84. struct rb_node *nd;
  85. bool has_single_node = (rb_first(root) == rb_last(root));
  86. for (nd = rb_first(root); nd; nd = rb_next(nd)) {
  87. struct callchain_node *node;
  88. struct callchain_list *chain;
  89. GtkTreeIter iter, new_parent;
  90. bool need_new_parent;
  91. node = rb_entry(nd, struct callchain_node, rb_node);
  92. new_parent = *parent;
  93. need_new_parent = !has_single_node;
  94. callchain_node__make_parent_list(node);
  95. list_for_each_entry(chain, &node->parent_val, list) {
  96. char buf[128];
  97. gtk_tree_store_append(store, &iter, &new_parent);
  98. callchain_node__scnprintf_value(node, buf, sizeof(buf), total);
  99. gtk_tree_store_set(store, &iter, 0, buf, -1);
  100. callchain_list__sym_name(chain, buf, sizeof(buf), false);
  101. gtk_tree_store_set(store, &iter, col, buf, -1);
  102. if (need_new_parent) {
  103. /*
  104. * Only show the top-most symbol in a callchain
  105. * if it's not the only callchain.
  106. */
  107. new_parent = iter;
  108. need_new_parent = false;
  109. }
  110. }
  111. list_for_each_entry(chain, &node->val, list) {
  112. char buf[128];
  113. gtk_tree_store_append(store, &iter, &new_parent);
  114. callchain_node__scnprintf_value(node, buf, sizeof(buf), total);
  115. gtk_tree_store_set(store, &iter, 0, buf, -1);
  116. callchain_list__sym_name(chain, buf, sizeof(buf), false);
  117. gtk_tree_store_set(store, &iter, col, buf, -1);
  118. if (need_new_parent) {
  119. /*
  120. * Only show the top-most symbol in a callchain
  121. * if it's not the only callchain.
  122. */
  123. new_parent = iter;
  124. need_new_parent = false;
  125. }
  126. }
  127. }
  128. }
  129. static void perf_gtk__add_callchain_folded(struct rb_root *root, GtkTreeStore *store,
  130. GtkTreeIter *parent, int col, u64 total)
  131. {
  132. struct rb_node *nd;
  133. for (nd = rb_first(root); nd; nd = rb_next(nd)) {
  134. struct callchain_node *node;
  135. struct callchain_list *chain;
  136. GtkTreeIter iter;
  137. char buf[64];
  138. char *str, *str_alloc = NULL;
  139. bool first = true;
  140. node = rb_entry(nd, struct callchain_node, rb_node);
  141. callchain_node__make_parent_list(node);
  142. list_for_each_entry(chain, &node->parent_val, list) {
  143. char name[1024];
  144. callchain_list__sym_name(chain, name, sizeof(name), false);
  145. if (asprintf(&str, "%s%s%s",
  146. first ? "" : str_alloc,
  147. first ? "" : symbol_conf.field_sep ?: "; ",
  148. name) < 0)
  149. return;
  150. first = false;
  151. free(str_alloc);
  152. str_alloc = str;
  153. }
  154. list_for_each_entry(chain, &node->val, list) {
  155. char name[1024];
  156. callchain_list__sym_name(chain, name, sizeof(name), false);
  157. if (asprintf(&str, "%s%s%s",
  158. first ? "" : str_alloc,
  159. first ? "" : symbol_conf.field_sep ?: "; ",
  160. name) < 0)
  161. return;
  162. first = false;
  163. free(str_alloc);
  164. str_alloc = str;
  165. }
  166. gtk_tree_store_append(store, &iter, parent);
  167. callchain_node__scnprintf_value(node, buf, sizeof(buf), total);
  168. gtk_tree_store_set(store, &iter, 0, buf, -1);
  169. gtk_tree_store_set(store, &iter, col, str, -1);
  170. free(str_alloc);
  171. }
  172. }
  173. static void perf_gtk__add_callchain_graph(struct rb_root *root, GtkTreeStore *store,
  174. GtkTreeIter *parent, int col, u64 total)
  175. {
  176. struct rb_node *nd;
  177. bool has_single_node = (rb_first(root) == rb_last(root));
  178. for (nd = rb_first(root); nd; nd = rb_next(nd)) {
  179. struct callchain_node *node;
  180. struct callchain_list *chain;
  181. GtkTreeIter iter, new_parent;
  182. bool need_new_parent;
  183. u64 child_total;
  184. node = rb_entry(nd, struct callchain_node, rb_node);
  185. new_parent = *parent;
  186. need_new_parent = !has_single_node && (node->val_nr > 1);
  187. list_for_each_entry(chain, &node->val, list) {
  188. char buf[128];
  189. gtk_tree_store_append(store, &iter, &new_parent);
  190. callchain_node__scnprintf_value(node, buf, sizeof(buf), total);
  191. gtk_tree_store_set(store, &iter, 0, buf, -1);
  192. callchain_list__sym_name(chain, buf, sizeof(buf), false);
  193. gtk_tree_store_set(store, &iter, col, buf, -1);
  194. if (need_new_parent) {
  195. /*
  196. * Only show the top-most symbol in a callchain
  197. * if it's not the only callchain.
  198. */
  199. new_parent = iter;
  200. need_new_parent = false;
  201. }
  202. }
  203. if (callchain_param.mode == CHAIN_GRAPH_REL)
  204. child_total = node->children_hit;
  205. else
  206. child_total = total;
  207. /* Now 'iter' contains info of the last callchain_list */
  208. perf_gtk__add_callchain_graph(&node->rb_root, store, &iter, col,
  209. child_total);
  210. }
  211. }
  212. static void perf_gtk__add_callchain(struct rb_root *root, GtkTreeStore *store,
  213. GtkTreeIter *parent, int col, u64 total)
  214. {
  215. if (callchain_param.mode == CHAIN_FLAT)
  216. perf_gtk__add_callchain_flat(root, store, parent, col, total);
  217. else if (callchain_param.mode == CHAIN_FOLDED)
  218. perf_gtk__add_callchain_folded(root, store, parent, col, total);
  219. else
  220. perf_gtk__add_callchain_graph(root, store, parent, col, total);
  221. }
  222. static void on_row_activated(GtkTreeView *view, GtkTreePath *path,
  223. GtkTreeViewColumn *col __maybe_unused,
  224. gpointer user_data __maybe_unused)
  225. {
  226. bool expanded = gtk_tree_view_row_expanded(view, path);
  227. if (expanded)
  228. gtk_tree_view_collapse_row(view, path);
  229. else
  230. gtk_tree_view_expand_row(view, path, FALSE);
  231. }
  232. static void perf_gtk__show_hists(GtkWidget *window, struct hists *hists,
  233. float min_pcnt)
  234. {
  235. struct perf_hpp_fmt *fmt;
  236. GType col_types[MAX_COLUMNS];
  237. GtkCellRenderer *renderer;
  238. GtkTreeStore *store;
  239. struct rb_node *nd;
  240. GtkWidget *view;
  241. int col_idx;
  242. int sym_col = -1;
  243. int nr_cols;
  244. char s[512];
  245. struct perf_hpp hpp = {
  246. .buf = s,
  247. .size = sizeof(s),
  248. };
  249. nr_cols = 0;
  250. hists__for_each_format(hists, fmt)
  251. col_types[nr_cols++] = G_TYPE_STRING;
  252. store = gtk_tree_store_newv(nr_cols, col_types);
  253. view = gtk_tree_view_new();
  254. renderer = gtk_cell_renderer_text_new();
  255. col_idx = 0;
  256. hists__for_each_format(hists, fmt) {
  257. if (perf_hpp__should_skip(fmt, hists))
  258. continue;
  259. /*
  260. * XXX no way to determine where symcol column is..
  261. * Just use last column for now.
  262. */
  263. if (perf_hpp__is_sort_entry(fmt))
  264. sym_col = col_idx;
  265. gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(view),
  266. -1, fmt->name,
  267. renderer, "markup",
  268. col_idx++, NULL);
  269. }
  270. for (col_idx = 0; col_idx < nr_cols; col_idx++) {
  271. GtkTreeViewColumn *column;
  272. column = gtk_tree_view_get_column(GTK_TREE_VIEW(view), col_idx);
  273. gtk_tree_view_column_set_resizable(column, TRUE);
  274. if (col_idx == sym_col) {
  275. gtk_tree_view_set_expander_column(GTK_TREE_VIEW(view),
  276. column);
  277. }
  278. }
  279. gtk_tree_view_set_model(GTK_TREE_VIEW(view), GTK_TREE_MODEL(store));
  280. g_object_unref(GTK_TREE_MODEL(store));
  281. for (nd = rb_first(&hists->entries); nd; nd = rb_next(nd)) {
  282. struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node);
  283. GtkTreeIter iter;
  284. u64 total = hists__total_period(h->hists);
  285. float percent;
  286. if (h->filtered)
  287. continue;
  288. percent = hist_entry__get_percent_limit(h);
  289. if (percent < min_pcnt)
  290. continue;
  291. gtk_tree_store_append(store, &iter, NULL);
  292. col_idx = 0;
  293. hists__for_each_format(hists, fmt) {
  294. if (perf_hpp__should_skip(fmt, h->hists))
  295. continue;
  296. if (fmt->color)
  297. fmt->color(fmt, &hpp, h);
  298. else
  299. fmt->entry(fmt, &hpp, h);
  300. gtk_tree_store_set(store, &iter, col_idx++, s, -1);
  301. }
  302. if (hist_entry__has_callchains(h) &&
  303. symbol_conf.use_callchain && hists__has(hists, sym)) {
  304. if (callchain_param.mode == CHAIN_GRAPH_REL)
  305. total = symbol_conf.cumulate_callchain ?
  306. h->stat_acc->period : h->stat.period;
  307. perf_gtk__add_callchain(&h->sorted_chain, store, &iter,
  308. sym_col, total);
  309. }
  310. }
  311. gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(view), TRUE);
  312. g_signal_connect(view, "row-activated",
  313. G_CALLBACK(on_row_activated), NULL);
  314. gtk_container_add(GTK_CONTAINER(window), view);
  315. }
  316. static void perf_gtk__add_hierarchy_entries(struct hists *hists,
  317. struct rb_root *root,
  318. GtkTreeStore *store,
  319. GtkTreeIter *parent,
  320. struct perf_hpp *hpp,
  321. float min_pcnt)
  322. {
  323. int col_idx = 0;
  324. struct rb_node *node;
  325. struct hist_entry *he;
  326. struct perf_hpp_fmt *fmt;
  327. struct perf_hpp_list_node *fmt_node;
  328. u64 total = hists__total_period(hists);
  329. int size;
  330. for (node = rb_first(root); node; node = rb_next(node)) {
  331. GtkTreeIter iter;
  332. float percent;
  333. char *bf;
  334. he = rb_entry(node, struct hist_entry, rb_node);
  335. if (he->filtered)
  336. continue;
  337. percent = hist_entry__get_percent_limit(he);
  338. if (percent < min_pcnt)
  339. continue;
  340. gtk_tree_store_append(store, &iter, parent);
  341. col_idx = 0;
  342. /* the first hpp_list_node is for overhead columns */
  343. fmt_node = list_first_entry(&hists->hpp_formats,
  344. struct perf_hpp_list_node, list);
  345. perf_hpp_list__for_each_format(&fmt_node->hpp, fmt) {
  346. if (fmt->color)
  347. fmt->color(fmt, hpp, he);
  348. else
  349. fmt->entry(fmt, hpp, he);
  350. gtk_tree_store_set(store, &iter, col_idx++, hpp->buf, -1);
  351. }
  352. bf = hpp->buf;
  353. size = hpp->size;
  354. perf_hpp_list__for_each_format(he->hpp_list, fmt) {
  355. int ret;
  356. if (fmt->color)
  357. ret = fmt->color(fmt, hpp, he);
  358. else
  359. ret = fmt->entry(fmt, hpp, he);
  360. snprintf(hpp->buf + ret, hpp->size - ret, " ");
  361. advance_hpp(hpp, ret + 2);
  362. }
  363. gtk_tree_store_set(store, &iter, col_idx, ltrim(rtrim(bf)), -1);
  364. if (!he->leaf) {
  365. hpp->buf = bf;
  366. hpp->size = size;
  367. perf_gtk__add_hierarchy_entries(hists, &he->hroot_out,
  368. store, &iter, hpp,
  369. min_pcnt);
  370. if (!hist_entry__has_hierarchy_children(he, min_pcnt)) {
  371. char buf[32];
  372. GtkTreeIter child;
  373. snprintf(buf, sizeof(buf), "no entry >= %.2f%%",
  374. min_pcnt);
  375. gtk_tree_store_append(store, &child, &iter);
  376. gtk_tree_store_set(store, &child, col_idx, buf, -1);
  377. }
  378. }
  379. if (he->leaf && hist_entry__has_callchains(he) && symbol_conf.use_callchain) {
  380. if (callchain_param.mode == CHAIN_GRAPH_REL)
  381. total = symbol_conf.cumulate_callchain ?
  382. he->stat_acc->period : he->stat.period;
  383. perf_gtk__add_callchain(&he->sorted_chain, store, &iter,
  384. col_idx, total);
  385. }
  386. }
  387. }
  388. static void perf_gtk__show_hierarchy(GtkWidget *window, struct hists *hists,
  389. float min_pcnt)
  390. {
  391. struct perf_hpp_fmt *fmt;
  392. struct perf_hpp_list_node *fmt_node;
  393. GType col_types[MAX_COLUMNS];
  394. GtkCellRenderer *renderer;
  395. GtkTreeStore *store;
  396. GtkWidget *view;
  397. int col_idx;
  398. int nr_cols = 0;
  399. char s[512];
  400. char buf[512];
  401. bool first_node, first_col;
  402. struct perf_hpp hpp = {
  403. .buf = s,
  404. .size = sizeof(s),
  405. };
  406. hists__for_each_format(hists, fmt) {
  407. if (perf_hpp__is_sort_entry(fmt) ||
  408. perf_hpp__is_dynamic_entry(fmt))
  409. break;
  410. col_types[nr_cols++] = G_TYPE_STRING;
  411. }
  412. col_types[nr_cols++] = G_TYPE_STRING;
  413. store = gtk_tree_store_newv(nr_cols, col_types);
  414. view = gtk_tree_view_new();
  415. renderer = gtk_cell_renderer_text_new();
  416. col_idx = 0;
  417. /* the first hpp_list_node is for overhead columns */
  418. fmt_node = list_first_entry(&hists->hpp_formats,
  419. struct perf_hpp_list_node, list);
  420. perf_hpp_list__for_each_format(&fmt_node->hpp, fmt) {
  421. gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(view),
  422. -1, fmt->name,
  423. renderer, "markup",
  424. col_idx++, NULL);
  425. }
  426. /* construct merged column header since sort keys share single column */
  427. buf[0] = '\0';
  428. first_node = true;
  429. list_for_each_entry_continue(fmt_node, &hists->hpp_formats, list) {
  430. if (!first_node)
  431. strcat(buf, " / ");
  432. first_node = false;
  433. first_col = true;
  434. perf_hpp_list__for_each_format(&fmt_node->hpp ,fmt) {
  435. if (perf_hpp__should_skip(fmt, hists))
  436. continue;
  437. if (!first_col)
  438. strcat(buf, "+");
  439. first_col = false;
  440. fmt->header(fmt, &hpp, hists, 0, NULL);
  441. strcat(buf, ltrim(rtrim(hpp.buf)));
  442. }
  443. }
  444. gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(view),
  445. -1, buf,
  446. renderer, "markup",
  447. col_idx++, NULL);
  448. for (col_idx = 0; col_idx < nr_cols; col_idx++) {
  449. GtkTreeViewColumn *column;
  450. column = gtk_tree_view_get_column(GTK_TREE_VIEW(view), col_idx);
  451. gtk_tree_view_column_set_resizable(column, TRUE);
  452. if (col_idx == 0) {
  453. gtk_tree_view_set_expander_column(GTK_TREE_VIEW(view),
  454. column);
  455. }
  456. }
  457. gtk_tree_view_set_model(GTK_TREE_VIEW(view), GTK_TREE_MODEL(store));
  458. g_object_unref(GTK_TREE_MODEL(store));
  459. perf_gtk__add_hierarchy_entries(hists, &hists->entries, store,
  460. NULL, &hpp, min_pcnt);
  461. gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(view), TRUE);
  462. g_signal_connect(view, "row-activated",
  463. G_CALLBACK(on_row_activated), NULL);
  464. gtk_container_add(GTK_CONTAINER(window), view);
  465. }
  466. int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist,
  467. const char *help,
  468. struct hist_browser_timer *hbt __maybe_unused,
  469. float min_pcnt)
  470. {
  471. struct perf_evsel *pos;
  472. GtkWidget *vbox;
  473. GtkWidget *notebook;
  474. GtkWidget *info_bar;
  475. GtkWidget *statbar;
  476. GtkWidget *window;
  477. signal(SIGSEGV, perf_gtk__signal);
  478. signal(SIGFPE, perf_gtk__signal);
  479. signal(SIGINT, perf_gtk__signal);
  480. signal(SIGQUIT, perf_gtk__signal);
  481. signal(SIGTERM, perf_gtk__signal);
  482. window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
  483. gtk_window_set_title(GTK_WINDOW(window), "perf report");
  484. g_signal_connect(window, "delete_event", gtk_main_quit, NULL);
  485. pgctx = perf_gtk__activate_context(window);
  486. if (!pgctx)
  487. return -1;
  488. vbox = gtk_vbox_new(FALSE, 0);
  489. notebook = gtk_notebook_new();
  490. gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0);
  491. info_bar = perf_gtk__setup_info_bar();
  492. if (info_bar)
  493. gtk_box_pack_start(GTK_BOX(vbox), info_bar, FALSE, FALSE, 0);
  494. statbar = perf_gtk__setup_statusbar();
  495. gtk_box_pack_start(GTK_BOX(vbox), statbar, FALSE, FALSE, 0);
  496. gtk_container_add(GTK_CONTAINER(window), vbox);
  497. evlist__for_each_entry(evlist, pos) {
  498. struct hists *hists = evsel__hists(pos);
  499. const char *evname = perf_evsel__name(pos);
  500. GtkWidget *scrolled_window;
  501. GtkWidget *tab_label;
  502. char buf[512];
  503. size_t size = sizeof(buf);
  504. if (symbol_conf.event_group) {
  505. if (!perf_evsel__is_group_leader(pos))
  506. continue;
  507. if (pos->nr_members > 1) {
  508. perf_evsel__group_desc(pos, buf, size);
  509. evname = buf;
  510. }
  511. }
  512. scrolled_window = gtk_scrolled_window_new(NULL, NULL);
  513. gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window),
  514. GTK_POLICY_AUTOMATIC,
  515. GTK_POLICY_AUTOMATIC);
  516. if (symbol_conf.report_hierarchy)
  517. perf_gtk__show_hierarchy(scrolled_window, hists, min_pcnt);
  518. else
  519. perf_gtk__show_hists(scrolled_window, hists, min_pcnt);
  520. tab_label = gtk_label_new(evname);
  521. gtk_notebook_append_page(GTK_NOTEBOOK(notebook), scrolled_window, tab_label);
  522. }
  523. gtk_widget_show_all(window);
  524. perf_gtk__resize_window(window);
  525. gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
  526. ui_helpline__push(help);
  527. gtk_main();
  528. perf_gtk__deactivate_context(&pgctx);
  529. return 0;
  530. }