hists.c 17 KB

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