xref: /kernel/linux/linux-5.10/tools/perf/ui/gtk/hists.c (revision 8c2ecf20)
18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci#include "../evlist.h"
38c2ecf20Sopenharmony_ci#include "../callchain.h"
48c2ecf20Sopenharmony_ci#include "../evsel.h"
58c2ecf20Sopenharmony_ci#include "../sort.h"
68c2ecf20Sopenharmony_ci#include "../hist.h"
78c2ecf20Sopenharmony_ci#include "../helpline.h"
88c2ecf20Sopenharmony_ci#include "../string2.h"
98c2ecf20Sopenharmony_ci#include "gtk.h"
108c2ecf20Sopenharmony_ci#include <signal.h>
118c2ecf20Sopenharmony_ci#include <stdlib.h>
128c2ecf20Sopenharmony_ci#include <linux/string.h>
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci#define MAX_COLUMNS			32
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_cistatic int __percent_color_snprintf(struct perf_hpp *hpp, const char *fmt, ...)
178c2ecf20Sopenharmony_ci{
188c2ecf20Sopenharmony_ci	int ret = 0;
198c2ecf20Sopenharmony_ci	int len;
208c2ecf20Sopenharmony_ci	va_list args;
218c2ecf20Sopenharmony_ci	double percent;
228c2ecf20Sopenharmony_ci	const char *markup;
238c2ecf20Sopenharmony_ci	char *buf = hpp->buf;
248c2ecf20Sopenharmony_ci	size_t size = hpp->size;
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci	va_start(args, fmt);
278c2ecf20Sopenharmony_ci	len = va_arg(args, int);
288c2ecf20Sopenharmony_ci	percent = va_arg(args, double);
298c2ecf20Sopenharmony_ci	va_end(args);
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci	markup = perf_gtk__get_percent_color(percent);
328c2ecf20Sopenharmony_ci	if (markup)
338c2ecf20Sopenharmony_ci		ret += scnprintf(buf, size, markup);
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci	ret += scnprintf(buf + ret, size - ret, fmt, len, percent);
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci	if (markup)
388c2ecf20Sopenharmony_ci		ret += scnprintf(buf + ret, size - ret, "</span>");
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci	return ret;
418c2ecf20Sopenharmony_ci}
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci#define __HPP_COLOR_PERCENT_FN(_type, _field)					\
448c2ecf20Sopenharmony_cistatic u64 he_get_##_field(struct hist_entry *he)				\
458c2ecf20Sopenharmony_ci{										\
468c2ecf20Sopenharmony_ci	return he->stat._field;							\
478c2ecf20Sopenharmony_ci}										\
488c2ecf20Sopenharmony_ci										\
498c2ecf20Sopenharmony_cistatic int perf_gtk__hpp_color_##_type(struct perf_hpp_fmt *fmt,		\
508c2ecf20Sopenharmony_ci				       struct perf_hpp *hpp,			\
518c2ecf20Sopenharmony_ci				       struct hist_entry *he)			\
528c2ecf20Sopenharmony_ci{										\
538c2ecf20Sopenharmony_ci	return hpp__fmt(fmt, hpp, he, he_get_##_field, " %*.2f%%",		\
548c2ecf20Sopenharmony_ci			__percent_color_snprintf, true);			\
558c2ecf20Sopenharmony_ci}
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ci#define __HPP_COLOR_ACC_PERCENT_FN(_type, _field)				\
588c2ecf20Sopenharmony_cistatic u64 he_get_acc_##_field(struct hist_entry *he)				\
598c2ecf20Sopenharmony_ci{										\
608c2ecf20Sopenharmony_ci	return he->stat_acc->_field;						\
618c2ecf20Sopenharmony_ci}										\
628c2ecf20Sopenharmony_ci										\
638c2ecf20Sopenharmony_cistatic int perf_gtk__hpp_color_##_type(struct perf_hpp_fmt *fmt,		\
648c2ecf20Sopenharmony_ci				       struct perf_hpp *hpp,			\
658c2ecf20Sopenharmony_ci				       struct hist_entry *he)			\
668c2ecf20Sopenharmony_ci{										\
678c2ecf20Sopenharmony_ci	return hpp__fmt_acc(fmt, hpp, he, he_get_acc_##_field, " %*.2f%%", 	\
688c2ecf20Sopenharmony_ci			    __percent_color_snprintf, true);			\
698c2ecf20Sopenharmony_ci}
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_ci__HPP_COLOR_PERCENT_FN(overhead, period)
728c2ecf20Sopenharmony_ci__HPP_COLOR_PERCENT_FN(overhead_sys, period_sys)
738c2ecf20Sopenharmony_ci__HPP_COLOR_PERCENT_FN(overhead_us, period_us)
748c2ecf20Sopenharmony_ci__HPP_COLOR_PERCENT_FN(overhead_guest_sys, period_guest_sys)
758c2ecf20Sopenharmony_ci__HPP_COLOR_PERCENT_FN(overhead_guest_us, period_guest_us)
768c2ecf20Sopenharmony_ci__HPP_COLOR_ACC_PERCENT_FN(overhead_acc, period)
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_ci#undef __HPP_COLOR_PERCENT_FN
798c2ecf20Sopenharmony_ci
808c2ecf20Sopenharmony_ci
818c2ecf20Sopenharmony_civoid perf_gtk__init_hpp(void)
828c2ecf20Sopenharmony_ci{
838c2ecf20Sopenharmony_ci	perf_hpp__format[PERF_HPP__OVERHEAD].color =
848c2ecf20Sopenharmony_ci				perf_gtk__hpp_color_overhead;
858c2ecf20Sopenharmony_ci	perf_hpp__format[PERF_HPP__OVERHEAD_SYS].color =
868c2ecf20Sopenharmony_ci				perf_gtk__hpp_color_overhead_sys;
878c2ecf20Sopenharmony_ci	perf_hpp__format[PERF_HPP__OVERHEAD_US].color =
888c2ecf20Sopenharmony_ci				perf_gtk__hpp_color_overhead_us;
898c2ecf20Sopenharmony_ci	perf_hpp__format[PERF_HPP__OVERHEAD_GUEST_SYS].color =
908c2ecf20Sopenharmony_ci				perf_gtk__hpp_color_overhead_guest_sys;
918c2ecf20Sopenharmony_ci	perf_hpp__format[PERF_HPP__OVERHEAD_GUEST_US].color =
928c2ecf20Sopenharmony_ci				perf_gtk__hpp_color_overhead_guest_us;
938c2ecf20Sopenharmony_ci	perf_hpp__format[PERF_HPP__OVERHEAD_ACC].color =
948c2ecf20Sopenharmony_ci				perf_gtk__hpp_color_overhead_acc;
958c2ecf20Sopenharmony_ci}
968c2ecf20Sopenharmony_ci
978c2ecf20Sopenharmony_cistatic void perf_gtk__add_callchain_flat(struct rb_root *root, GtkTreeStore *store,
988c2ecf20Sopenharmony_ci					 GtkTreeIter *parent, int col, u64 total)
998c2ecf20Sopenharmony_ci{
1008c2ecf20Sopenharmony_ci	struct rb_node *nd;
1018c2ecf20Sopenharmony_ci	bool has_single_node = (rb_first(root) == rb_last(root));
1028c2ecf20Sopenharmony_ci
1038c2ecf20Sopenharmony_ci	for (nd = rb_first(root); nd; nd = rb_next(nd)) {
1048c2ecf20Sopenharmony_ci		struct callchain_node *node;
1058c2ecf20Sopenharmony_ci		struct callchain_list *chain;
1068c2ecf20Sopenharmony_ci		GtkTreeIter iter, new_parent;
1078c2ecf20Sopenharmony_ci		bool need_new_parent;
1088c2ecf20Sopenharmony_ci
1098c2ecf20Sopenharmony_ci		node = rb_entry(nd, struct callchain_node, rb_node);
1108c2ecf20Sopenharmony_ci
1118c2ecf20Sopenharmony_ci		new_parent = *parent;
1128c2ecf20Sopenharmony_ci		need_new_parent = !has_single_node;
1138c2ecf20Sopenharmony_ci
1148c2ecf20Sopenharmony_ci		callchain_node__make_parent_list(node);
1158c2ecf20Sopenharmony_ci
1168c2ecf20Sopenharmony_ci		list_for_each_entry(chain, &node->parent_val, list) {
1178c2ecf20Sopenharmony_ci			char buf[128];
1188c2ecf20Sopenharmony_ci
1198c2ecf20Sopenharmony_ci			gtk_tree_store_append(store, &iter, &new_parent);
1208c2ecf20Sopenharmony_ci
1218c2ecf20Sopenharmony_ci			callchain_node__scnprintf_value(node, buf, sizeof(buf), total);
1228c2ecf20Sopenharmony_ci			gtk_tree_store_set(store, &iter, 0, buf, -1);
1238c2ecf20Sopenharmony_ci
1248c2ecf20Sopenharmony_ci			callchain_list__sym_name(chain, buf, sizeof(buf), false);
1258c2ecf20Sopenharmony_ci			gtk_tree_store_set(store, &iter, col, buf, -1);
1268c2ecf20Sopenharmony_ci
1278c2ecf20Sopenharmony_ci			if (need_new_parent) {
1288c2ecf20Sopenharmony_ci				/*
1298c2ecf20Sopenharmony_ci				 * Only show the top-most symbol in a callchain
1308c2ecf20Sopenharmony_ci				 * if it's not the only callchain.
1318c2ecf20Sopenharmony_ci				 */
1328c2ecf20Sopenharmony_ci				new_parent = iter;
1338c2ecf20Sopenharmony_ci				need_new_parent = false;
1348c2ecf20Sopenharmony_ci			}
1358c2ecf20Sopenharmony_ci		}
1368c2ecf20Sopenharmony_ci
1378c2ecf20Sopenharmony_ci		list_for_each_entry(chain, &node->val, list) {
1388c2ecf20Sopenharmony_ci			char buf[128];
1398c2ecf20Sopenharmony_ci
1408c2ecf20Sopenharmony_ci			gtk_tree_store_append(store, &iter, &new_parent);
1418c2ecf20Sopenharmony_ci
1428c2ecf20Sopenharmony_ci			callchain_node__scnprintf_value(node, buf, sizeof(buf), total);
1438c2ecf20Sopenharmony_ci			gtk_tree_store_set(store, &iter, 0, buf, -1);
1448c2ecf20Sopenharmony_ci
1458c2ecf20Sopenharmony_ci			callchain_list__sym_name(chain, buf, sizeof(buf), false);
1468c2ecf20Sopenharmony_ci			gtk_tree_store_set(store, &iter, col, buf, -1);
1478c2ecf20Sopenharmony_ci
1488c2ecf20Sopenharmony_ci			if (need_new_parent) {
1498c2ecf20Sopenharmony_ci				/*
1508c2ecf20Sopenharmony_ci				 * Only show the top-most symbol in a callchain
1518c2ecf20Sopenharmony_ci				 * if it's not the only callchain.
1528c2ecf20Sopenharmony_ci				 */
1538c2ecf20Sopenharmony_ci				new_parent = iter;
1548c2ecf20Sopenharmony_ci				need_new_parent = false;
1558c2ecf20Sopenharmony_ci			}
1568c2ecf20Sopenharmony_ci		}
1578c2ecf20Sopenharmony_ci	}
1588c2ecf20Sopenharmony_ci}
1598c2ecf20Sopenharmony_ci
1608c2ecf20Sopenharmony_cistatic void perf_gtk__add_callchain_folded(struct rb_root *root, GtkTreeStore *store,
1618c2ecf20Sopenharmony_ci					   GtkTreeIter *parent, int col, u64 total)
1628c2ecf20Sopenharmony_ci{
1638c2ecf20Sopenharmony_ci	struct rb_node *nd;
1648c2ecf20Sopenharmony_ci
1658c2ecf20Sopenharmony_ci	for (nd = rb_first(root); nd; nd = rb_next(nd)) {
1668c2ecf20Sopenharmony_ci		struct callchain_node *node;
1678c2ecf20Sopenharmony_ci		struct callchain_list *chain;
1688c2ecf20Sopenharmony_ci		GtkTreeIter iter;
1698c2ecf20Sopenharmony_ci		char buf[64];
1708c2ecf20Sopenharmony_ci		char *str, *str_alloc = NULL;
1718c2ecf20Sopenharmony_ci		bool first = true;
1728c2ecf20Sopenharmony_ci
1738c2ecf20Sopenharmony_ci		node = rb_entry(nd, struct callchain_node, rb_node);
1748c2ecf20Sopenharmony_ci
1758c2ecf20Sopenharmony_ci		callchain_node__make_parent_list(node);
1768c2ecf20Sopenharmony_ci
1778c2ecf20Sopenharmony_ci		list_for_each_entry(chain, &node->parent_val, list) {
1788c2ecf20Sopenharmony_ci			char name[1024];
1798c2ecf20Sopenharmony_ci
1808c2ecf20Sopenharmony_ci			callchain_list__sym_name(chain, name, sizeof(name), false);
1818c2ecf20Sopenharmony_ci
1828c2ecf20Sopenharmony_ci			if (asprintf(&str, "%s%s%s",
1838c2ecf20Sopenharmony_ci				     first ? "" : str_alloc,
1848c2ecf20Sopenharmony_ci				     first ? "" : symbol_conf.field_sep ?: "; ",
1858c2ecf20Sopenharmony_ci				     name) < 0)
1868c2ecf20Sopenharmony_ci				return;
1878c2ecf20Sopenharmony_ci
1888c2ecf20Sopenharmony_ci			first = false;
1898c2ecf20Sopenharmony_ci			free(str_alloc);
1908c2ecf20Sopenharmony_ci			str_alloc = str;
1918c2ecf20Sopenharmony_ci		}
1928c2ecf20Sopenharmony_ci
1938c2ecf20Sopenharmony_ci		list_for_each_entry(chain, &node->val, list) {
1948c2ecf20Sopenharmony_ci			char name[1024];
1958c2ecf20Sopenharmony_ci
1968c2ecf20Sopenharmony_ci			callchain_list__sym_name(chain, name, sizeof(name), false);
1978c2ecf20Sopenharmony_ci
1988c2ecf20Sopenharmony_ci			if (asprintf(&str, "%s%s%s",
1998c2ecf20Sopenharmony_ci				     first ? "" : str_alloc,
2008c2ecf20Sopenharmony_ci				     first ? "" : symbol_conf.field_sep ?: "; ",
2018c2ecf20Sopenharmony_ci				     name) < 0)
2028c2ecf20Sopenharmony_ci				return;
2038c2ecf20Sopenharmony_ci
2048c2ecf20Sopenharmony_ci			first = false;
2058c2ecf20Sopenharmony_ci			free(str_alloc);
2068c2ecf20Sopenharmony_ci			str_alloc = str;
2078c2ecf20Sopenharmony_ci		}
2088c2ecf20Sopenharmony_ci
2098c2ecf20Sopenharmony_ci		gtk_tree_store_append(store, &iter, parent);
2108c2ecf20Sopenharmony_ci
2118c2ecf20Sopenharmony_ci		callchain_node__scnprintf_value(node, buf, sizeof(buf), total);
2128c2ecf20Sopenharmony_ci		gtk_tree_store_set(store, &iter, 0, buf, -1);
2138c2ecf20Sopenharmony_ci
2148c2ecf20Sopenharmony_ci		gtk_tree_store_set(store, &iter, col, str, -1);
2158c2ecf20Sopenharmony_ci
2168c2ecf20Sopenharmony_ci		free(str_alloc);
2178c2ecf20Sopenharmony_ci	}
2188c2ecf20Sopenharmony_ci}
2198c2ecf20Sopenharmony_ci
2208c2ecf20Sopenharmony_cistatic void perf_gtk__add_callchain_graph(struct rb_root *root, GtkTreeStore *store,
2218c2ecf20Sopenharmony_ci					  GtkTreeIter *parent, int col, u64 total)
2228c2ecf20Sopenharmony_ci{
2238c2ecf20Sopenharmony_ci	struct rb_node *nd;
2248c2ecf20Sopenharmony_ci	bool has_single_node = (rb_first(root) == rb_last(root));
2258c2ecf20Sopenharmony_ci
2268c2ecf20Sopenharmony_ci	for (nd = rb_first(root); nd; nd = rb_next(nd)) {
2278c2ecf20Sopenharmony_ci		struct callchain_node *node;
2288c2ecf20Sopenharmony_ci		struct callchain_list *chain;
2298c2ecf20Sopenharmony_ci		GtkTreeIter iter, new_parent;
2308c2ecf20Sopenharmony_ci		bool need_new_parent;
2318c2ecf20Sopenharmony_ci		u64 child_total;
2328c2ecf20Sopenharmony_ci
2338c2ecf20Sopenharmony_ci		node = rb_entry(nd, struct callchain_node, rb_node);
2348c2ecf20Sopenharmony_ci
2358c2ecf20Sopenharmony_ci		new_parent = *parent;
2368c2ecf20Sopenharmony_ci		need_new_parent = !has_single_node && (node->val_nr > 1);
2378c2ecf20Sopenharmony_ci
2388c2ecf20Sopenharmony_ci		list_for_each_entry(chain, &node->val, list) {
2398c2ecf20Sopenharmony_ci			char buf[128];
2408c2ecf20Sopenharmony_ci
2418c2ecf20Sopenharmony_ci			gtk_tree_store_append(store, &iter, &new_parent);
2428c2ecf20Sopenharmony_ci
2438c2ecf20Sopenharmony_ci			callchain_node__scnprintf_value(node, buf, sizeof(buf), total);
2448c2ecf20Sopenharmony_ci			gtk_tree_store_set(store, &iter, 0, buf, -1);
2458c2ecf20Sopenharmony_ci
2468c2ecf20Sopenharmony_ci			callchain_list__sym_name(chain, buf, sizeof(buf), false);
2478c2ecf20Sopenharmony_ci			gtk_tree_store_set(store, &iter, col, buf, -1);
2488c2ecf20Sopenharmony_ci
2498c2ecf20Sopenharmony_ci			if (need_new_parent) {
2508c2ecf20Sopenharmony_ci				/*
2518c2ecf20Sopenharmony_ci				 * Only show the top-most symbol in a callchain
2528c2ecf20Sopenharmony_ci				 * if it's not the only callchain.
2538c2ecf20Sopenharmony_ci				 */
2548c2ecf20Sopenharmony_ci				new_parent = iter;
2558c2ecf20Sopenharmony_ci				need_new_parent = false;
2568c2ecf20Sopenharmony_ci			}
2578c2ecf20Sopenharmony_ci		}
2588c2ecf20Sopenharmony_ci
2598c2ecf20Sopenharmony_ci		if (callchain_param.mode == CHAIN_GRAPH_REL)
2608c2ecf20Sopenharmony_ci			child_total = node->children_hit;
2618c2ecf20Sopenharmony_ci		else
2628c2ecf20Sopenharmony_ci			child_total = total;
2638c2ecf20Sopenharmony_ci
2648c2ecf20Sopenharmony_ci		/* Now 'iter' contains info of the last callchain_list */
2658c2ecf20Sopenharmony_ci		perf_gtk__add_callchain_graph(&node->rb_root, store, &iter, col,
2668c2ecf20Sopenharmony_ci					      child_total);
2678c2ecf20Sopenharmony_ci	}
2688c2ecf20Sopenharmony_ci}
2698c2ecf20Sopenharmony_ci
2708c2ecf20Sopenharmony_cistatic void perf_gtk__add_callchain(struct rb_root *root, GtkTreeStore *store,
2718c2ecf20Sopenharmony_ci				    GtkTreeIter *parent, int col, u64 total)
2728c2ecf20Sopenharmony_ci{
2738c2ecf20Sopenharmony_ci	if (callchain_param.mode == CHAIN_FLAT)
2748c2ecf20Sopenharmony_ci		perf_gtk__add_callchain_flat(root, store, parent, col, total);
2758c2ecf20Sopenharmony_ci	else if (callchain_param.mode == CHAIN_FOLDED)
2768c2ecf20Sopenharmony_ci		perf_gtk__add_callchain_folded(root, store, parent, col, total);
2778c2ecf20Sopenharmony_ci	else
2788c2ecf20Sopenharmony_ci		perf_gtk__add_callchain_graph(root, store, parent, col, total);
2798c2ecf20Sopenharmony_ci}
2808c2ecf20Sopenharmony_ci
2818c2ecf20Sopenharmony_cistatic void on_row_activated(GtkTreeView *view, GtkTreePath *path,
2828c2ecf20Sopenharmony_ci			     GtkTreeViewColumn *col __maybe_unused,
2838c2ecf20Sopenharmony_ci			     gpointer user_data __maybe_unused)
2848c2ecf20Sopenharmony_ci{
2858c2ecf20Sopenharmony_ci	bool expanded = gtk_tree_view_row_expanded(view, path);
2868c2ecf20Sopenharmony_ci
2878c2ecf20Sopenharmony_ci	if (expanded)
2888c2ecf20Sopenharmony_ci		gtk_tree_view_collapse_row(view, path);
2898c2ecf20Sopenharmony_ci	else
2908c2ecf20Sopenharmony_ci		gtk_tree_view_expand_row(view, path, FALSE);
2918c2ecf20Sopenharmony_ci}
2928c2ecf20Sopenharmony_ci
2938c2ecf20Sopenharmony_cistatic void perf_gtk__show_hists(GtkWidget *window, struct hists *hists,
2948c2ecf20Sopenharmony_ci				 float min_pcnt)
2958c2ecf20Sopenharmony_ci{
2968c2ecf20Sopenharmony_ci	struct perf_hpp_fmt *fmt;
2978c2ecf20Sopenharmony_ci	GType col_types[MAX_COLUMNS];
2988c2ecf20Sopenharmony_ci	GtkCellRenderer *renderer;
2998c2ecf20Sopenharmony_ci	GtkTreeStore *store;
3008c2ecf20Sopenharmony_ci	struct rb_node *nd;
3018c2ecf20Sopenharmony_ci	GtkWidget *view;
3028c2ecf20Sopenharmony_ci	int col_idx;
3038c2ecf20Sopenharmony_ci	int sym_col = -1;
3048c2ecf20Sopenharmony_ci	int nr_cols;
3058c2ecf20Sopenharmony_ci	char s[512];
3068c2ecf20Sopenharmony_ci
3078c2ecf20Sopenharmony_ci	struct perf_hpp hpp = {
3088c2ecf20Sopenharmony_ci		.buf		= s,
3098c2ecf20Sopenharmony_ci		.size		= sizeof(s),
3108c2ecf20Sopenharmony_ci	};
3118c2ecf20Sopenharmony_ci
3128c2ecf20Sopenharmony_ci	nr_cols = 0;
3138c2ecf20Sopenharmony_ci
3148c2ecf20Sopenharmony_ci	hists__for_each_format(hists, fmt)
3158c2ecf20Sopenharmony_ci		col_types[nr_cols++] = G_TYPE_STRING;
3168c2ecf20Sopenharmony_ci
3178c2ecf20Sopenharmony_ci	store = gtk_tree_store_newv(nr_cols, col_types);
3188c2ecf20Sopenharmony_ci
3198c2ecf20Sopenharmony_ci	view = gtk_tree_view_new();
3208c2ecf20Sopenharmony_ci
3218c2ecf20Sopenharmony_ci	renderer = gtk_cell_renderer_text_new();
3228c2ecf20Sopenharmony_ci
3238c2ecf20Sopenharmony_ci	col_idx = 0;
3248c2ecf20Sopenharmony_ci
3258c2ecf20Sopenharmony_ci	hists__for_each_format(hists, fmt) {
3268c2ecf20Sopenharmony_ci		if (perf_hpp__should_skip(fmt, hists))
3278c2ecf20Sopenharmony_ci			continue;
3288c2ecf20Sopenharmony_ci
3298c2ecf20Sopenharmony_ci		/*
3308c2ecf20Sopenharmony_ci		 * XXX no way to determine where symcol column is..
3318c2ecf20Sopenharmony_ci		 *     Just use last column for now.
3328c2ecf20Sopenharmony_ci		 */
3338c2ecf20Sopenharmony_ci		if (perf_hpp__is_sort_entry(fmt))
3348c2ecf20Sopenharmony_ci			sym_col = col_idx;
3358c2ecf20Sopenharmony_ci
3368c2ecf20Sopenharmony_ci		gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(view),
3378c2ecf20Sopenharmony_ci							    -1, fmt->name,
3388c2ecf20Sopenharmony_ci							    renderer, "markup",
3398c2ecf20Sopenharmony_ci							    col_idx++, NULL);
3408c2ecf20Sopenharmony_ci	}
3418c2ecf20Sopenharmony_ci
3428c2ecf20Sopenharmony_ci	for (col_idx = 0; col_idx < nr_cols; col_idx++) {
3438c2ecf20Sopenharmony_ci		GtkTreeViewColumn *column;
3448c2ecf20Sopenharmony_ci
3458c2ecf20Sopenharmony_ci		column = gtk_tree_view_get_column(GTK_TREE_VIEW(view), col_idx);
3468c2ecf20Sopenharmony_ci		gtk_tree_view_column_set_resizable(column, TRUE);
3478c2ecf20Sopenharmony_ci
3488c2ecf20Sopenharmony_ci		if (col_idx == sym_col) {
3498c2ecf20Sopenharmony_ci			gtk_tree_view_set_expander_column(GTK_TREE_VIEW(view),
3508c2ecf20Sopenharmony_ci							  column);
3518c2ecf20Sopenharmony_ci		}
3528c2ecf20Sopenharmony_ci	}
3538c2ecf20Sopenharmony_ci
3548c2ecf20Sopenharmony_ci	gtk_tree_view_set_model(GTK_TREE_VIEW(view), GTK_TREE_MODEL(store));
3558c2ecf20Sopenharmony_ci
3568c2ecf20Sopenharmony_ci	g_object_unref(GTK_TREE_MODEL(store));
3578c2ecf20Sopenharmony_ci
3588c2ecf20Sopenharmony_ci	for (nd = rb_first_cached(&hists->entries); nd; nd = rb_next(nd)) {
3598c2ecf20Sopenharmony_ci		struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node);
3608c2ecf20Sopenharmony_ci		GtkTreeIter iter;
3618c2ecf20Sopenharmony_ci		u64 total = hists__total_period(h->hists);
3628c2ecf20Sopenharmony_ci		float percent;
3638c2ecf20Sopenharmony_ci
3648c2ecf20Sopenharmony_ci		if (h->filtered)
3658c2ecf20Sopenharmony_ci			continue;
3668c2ecf20Sopenharmony_ci
3678c2ecf20Sopenharmony_ci		percent = hist_entry__get_percent_limit(h);
3688c2ecf20Sopenharmony_ci		if (percent < min_pcnt)
3698c2ecf20Sopenharmony_ci			continue;
3708c2ecf20Sopenharmony_ci
3718c2ecf20Sopenharmony_ci		gtk_tree_store_append(store, &iter, NULL);
3728c2ecf20Sopenharmony_ci
3738c2ecf20Sopenharmony_ci		col_idx = 0;
3748c2ecf20Sopenharmony_ci
3758c2ecf20Sopenharmony_ci		hists__for_each_format(hists, fmt) {
3768c2ecf20Sopenharmony_ci			if (perf_hpp__should_skip(fmt, h->hists))
3778c2ecf20Sopenharmony_ci				continue;
3788c2ecf20Sopenharmony_ci
3798c2ecf20Sopenharmony_ci			if (fmt->color)
3808c2ecf20Sopenharmony_ci				fmt->color(fmt, &hpp, h);
3818c2ecf20Sopenharmony_ci			else
3828c2ecf20Sopenharmony_ci				fmt->entry(fmt, &hpp, h);
3838c2ecf20Sopenharmony_ci
3848c2ecf20Sopenharmony_ci			gtk_tree_store_set(store, &iter, col_idx++, s, -1);
3858c2ecf20Sopenharmony_ci		}
3868c2ecf20Sopenharmony_ci
3878c2ecf20Sopenharmony_ci		if (hist_entry__has_callchains(h) &&
3888c2ecf20Sopenharmony_ci		    symbol_conf.use_callchain && hists__has(hists, sym)) {
3898c2ecf20Sopenharmony_ci			if (callchain_param.mode == CHAIN_GRAPH_REL)
3908c2ecf20Sopenharmony_ci				total = symbol_conf.cumulate_callchain ?
3918c2ecf20Sopenharmony_ci					h->stat_acc->period : h->stat.period;
3928c2ecf20Sopenharmony_ci
3938c2ecf20Sopenharmony_ci			perf_gtk__add_callchain(&h->sorted_chain, store, &iter,
3948c2ecf20Sopenharmony_ci						sym_col, total);
3958c2ecf20Sopenharmony_ci		}
3968c2ecf20Sopenharmony_ci	}
3978c2ecf20Sopenharmony_ci
3988c2ecf20Sopenharmony_ci	gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(view), TRUE);
3998c2ecf20Sopenharmony_ci
4008c2ecf20Sopenharmony_ci	g_signal_connect(view, "row-activated",
4018c2ecf20Sopenharmony_ci			 G_CALLBACK(on_row_activated), NULL);
4028c2ecf20Sopenharmony_ci	gtk_container_add(GTK_CONTAINER(window), view);
4038c2ecf20Sopenharmony_ci}
4048c2ecf20Sopenharmony_ci
4058c2ecf20Sopenharmony_cistatic void perf_gtk__add_hierarchy_entries(struct hists *hists,
4068c2ecf20Sopenharmony_ci					    struct rb_root_cached *root,
4078c2ecf20Sopenharmony_ci					    GtkTreeStore *store,
4088c2ecf20Sopenharmony_ci					    GtkTreeIter *parent,
4098c2ecf20Sopenharmony_ci					    struct perf_hpp *hpp,
4108c2ecf20Sopenharmony_ci					    float min_pcnt)
4118c2ecf20Sopenharmony_ci{
4128c2ecf20Sopenharmony_ci	int col_idx = 0;
4138c2ecf20Sopenharmony_ci	struct rb_node *node;
4148c2ecf20Sopenharmony_ci	struct hist_entry *he;
4158c2ecf20Sopenharmony_ci	struct perf_hpp_fmt *fmt;
4168c2ecf20Sopenharmony_ci	struct perf_hpp_list_node *fmt_node;
4178c2ecf20Sopenharmony_ci	u64 total = hists__total_period(hists);
4188c2ecf20Sopenharmony_ci	int size;
4198c2ecf20Sopenharmony_ci
4208c2ecf20Sopenharmony_ci	for (node = rb_first_cached(root); node; node = rb_next(node)) {
4218c2ecf20Sopenharmony_ci		GtkTreeIter iter;
4228c2ecf20Sopenharmony_ci		float percent;
4238c2ecf20Sopenharmony_ci		char *bf;
4248c2ecf20Sopenharmony_ci
4258c2ecf20Sopenharmony_ci		he = rb_entry(node, struct hist_entry, rb_node);
4268c2ecf20Sopenharmony_ci		if (he->filtered)
4278c2ecf20Sopenharmony_ci			continue;
4288c2ecf20Sopenharmony_ci
4298c2ecf20Sopenharmony_ci		percent = hist_entry__get_percent_limit(he);
4308c2ecf20Sopenharmony_ci		if (percent < min_pcnt)
4318c2ecf20Sopenharmony_ci			continue;
4328c2ecf20Sopenharmony_ci
4338c2ecf20Sopenharmony_ci		gtk_tree_store_append(store, &iter, parent);
4348c2ecf20Sopenharmony_ci
4358c2ecf20Sopenharmony_ci		col_idx = 0;
4368c2ecf20Sopenharmony_ci
4378c2ecf20Sopenharmony_ci		/* the first hpp_list_node is for overhead columns */
4388c2ecf20Sopenharmony_ci		fmt_node = list_first_entry(&hists->hpp_formats,
4398c2ecf20Sopenharmony_ci					    struct perf_hpp_list_node, list);
4408c2ecf20Sopenharmony_ci		perf_hpp_list__for_each_format(&fmt_node->hpp, fmt) {
4418c2ecf20Sopenharmony_ci			if (fmt->color)
4428c2ecf20Sopenharmony_ci				fmt->color(fmt, hpp, he);
4438c2ecf20Sopenharmony_ci			else
4448c2ecf20Sopenharmony_ci				fmt->entry(fmt, hpp, he);
4458c2ecf20Sopenharmony_ci
4468c2ecf20Sopenharmony_ci			gtk_tree_store_set(store, &iter, col_idx++, hpp->buf, -1);
4478c2ecf20Sopenharmony_ci		}
4488c2ecf20Sopenharmony_ci
4498c2ecf20Sopenharmony_ci		bf = hpp->buf;
4508c2ecf20Sopenharmony_ci		size = hpp->size;
4518c2ecf20Sopenharmony_ci		perf_hpp_list__for_each_format(he->hpp_list, fmt) {
4528c2ecf20Sopenharmony_ci			int ret;
4538c2ecf20Sopenharmony_ci
4548c2ecf20Sopenharmony_ci			if (fmt->color)
4558c2ecf20Sopenharmony_ci				ret = fmt->color(fmt, hpp, he);
4568c2ecf20Sopenharmony_ci			else
4578c2ecf20Sopenharmony_ci				ret = fmt->entry(fmt, hpp, he);
4588c2ecf20Sopenharmony_ci
4598c2ecf20Sopenharmony_ci			snprintf(hpp->buf + ret, hpp->size - ret, "  ");
4608c2ecf20Sopenharmony_ci			advance_hpp(hpp, ret + 2);
4618c2ecf20Sopenharmony_ci		}
4628c2ecf20Sopenharmony_ci
4638c2ecf20Sopenharmony_ci		gtk_tree_store_set(store, &iter, col_idx, strim(bf), -1);
4648c2ecf20Sopenharmony_ci
4658c2ecf20Sopenharmony_ci		if (!he->leaf) {
4668c2ecf20Sopenharmony_ci			hpp->buf = bf;
4678c2ecf20Sopenharmony_ci			hpp->size = size;
4688c2ecf20Sopenharmony_ci
4698c2ecf20Sopenharmony_ci			perf_gtk__add_hierarchy_entries(hists, &he->hroot_out,
4708c2ecf20Sopenharmony_ci							store, &iter, hpp,
4718c2ecf20Sopenharmony_ci							min_pcnt);
4728c2ecf20Sopenharmony_ci
4738c2ecf20Sopenharmony_ci			if (!hist_entry__has_hierarchy_children(he, min_pcnt)) {
4748c2ecf20Sopenharmony_ci				char buf[32];
4758c2ecf20Sopenharmony_ci				GtkTreeIter child;
4768c2ecf20Sopenharmony_ci
4778c2ecf20Sopenharmony_ci				snprintf(buf, sizeof(buf), "no entry >= %.2f%%",
4788c2ecf20Sopenharmony_ci					 min_pcnt);
4798c2ecf20Sopenharmony_ci
4808c2ecf20Sopenharmony_ci				gtk_tree_store_append(store, &child, &iter);
4818c2ecf20Sopenharmony_ci				gtk_tree_store_set(store, &child, col_idx, buf, -1);
4828c2ecf20Sopenharmony_ci			}
4838c2ecf20Sopenharmony_ci		}
4848c2ecf20Sopenharmony_ci
4858c2ecf20Sopenharmony_ci		if (he->leaf && hist_entry__has_callchains(he) && symbol_conf.use_callchain) {
4868c2ecf20Sopenharmony_ci			if (callchain_param.mode == CHAIN_GRAPH_REL)
4878c2ecf20Sopenharmony_ci				total = symbol_conf.cumulate_callchain ?
4888c2ecf20Sopenharmony_ci					he->stat_acc->period : he->stat.period;
4898c2ecf20Sopenharmony_ci
4908c2ecf20Sopenharmony_ci			perf_gtk__add_callchain(&he->sorted_chain, store, &iter,
4918c2ecf20Sopenharmony_ci						col_idx, total);
4928c2ecf20Sopenharmony_ci		}
4938c2ecf20Sopenharmony_ci	}
4948c2ecf20Sopenharmony_ci
4958c2ecf20Sopenharmony_ci}
4968c2ecf20Sopenharmony_ci
4978c2ecf20Sopenharmony_cistatic void perf_gtk__show_hierarchy(GtkWidget *window, struct hists *hists,
4988c2ecf20Sopenharmony_ci				     float min_pcnt)
4998c2ecf20Sopenharmony_ci{
5008c2ecf20Sopenharmony_ci	struct perf_hpp_fmt *fmt;
5018c2ecf20Sopenharmony_ci	struct perf_hpp_list_node *fmt_node;
5028c2ecf20Sopenharmony_ci	GType col_types[MAX_COLUMNS];
5038c2ecf20Sopenharmony_ci	GtkCellRenderer *renderer;
5048c2ecf20Sopenharmony_ci	GtkTreeStore *store;
5058c2ecf20Sopenharmony_ci	GtkWidget *view;
5068c2ecf20Sopenharmony_ci	int col_idx;
5078c2ecf20Sopenharmony_ci	int nr_cols = 0;
5088c2ecf20Sopenharmony_ci	char s[512];
5098c2ecf20Sopenharmony_ci	char buf[512];
5108c2ecf20Sopenharmony_ci	bool first_node, first_col;
5118c2ecf20Sopenharmony_ci	struct perf_hpp hpp = {
5128c2ecf20Sopenharmony_ci		.buf		= s,
5138c2ecf20Sopenharmony_ci		.size		= sizeof(s),
5148c2ecf20Sopenharmony_ci	};
5158c2ecf20Sopenharmony_ci
5168c2ecf20Sopenharmony_ci	hists__for_each_format(hists, fmt) {
5178c2ecf20Sopenharmony_ci		if (perf_hpp__is_sort_entry(fmt) ||
5188c2ecf20Sopenharmony_ci		    perf_hpp__is_dynamic_entry(fmt))
5198c2ecf20Sopenharmony_ci			break;
5208c2ecf20Sopenharmony_ci
5218c2ecf20Sopenharmony_ci		col_types[nr_cols++] = G_TYPE_STRING;
5228c2ecf20Sopenharmony_ci	}
5238c2ecf20Sopenharmony_ci	col_types[nr_cols++] = G_TYPE_STRING;
5248c2ecf20Sopenharmony_ci
5258c2ecf20Sopenharmony_ci	store = gtk_tree_store_newv(nr_cols, col_types);
5268c2ecf20Sopenharmony_ci	view = gtk_tree_view_new();
5278c2ecf20Sopenharmony_ci	renderer = gtk_cell_renderer_text_new();
5288c2ecf20Sopenharmony_ci
5298c2ecf20Sopenharmony_ci	col_idx = 0;
5308c2ecf20Sopenharmony_ci
5318c2ecf20Sopenharmony_ci	/* the first hpp_list_node is for overhead columns */
5328c2ecf20Sopenharmony_ci	fmt_node = list_first_entry(&hists->hpp_formats,
5338c2ecf20Sopenharmony_ci				    struct perf_hpp_list_node, list);
5348c2ecf20Sopenharmony_ci	perf_hpp_list__for_each_format(&fmt_node->hpp, fmt) {
5358c2ecf20Sopenharmony_ci		gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(view),
5368c2ecf20Sopenharmony_ci							    -1, fmt->name,
5378c2ecf20Sopenharmony_ci							    renderer, "markup",
5388c2ecf20Sopenharmony_ci							    col_idx++, NULL);
5398c2ecf20Sopenharmony_ci	}
5408c2ecf20Sopenharmony_ci
5418c2ecf20Sopenharmony_ci	/* construct merged column header since sort keys share single column */
5428c2ecf20Sopenharmony_ci	buf[0] = '\0';
5438c2ecf20Sopenharmony_ci	first_node = true;
5448c2ecf20Sopenharmony_ci	list_for_each_entry_continue(fmt_node, &hists->hpp_formats, list) {
5458c2ecf20Sopenharmony_ci		if (!first_node)
5468c2ecf20Sopenharmony_ci			strcat(buf, " / ");
5478c2ecf20Sopenharmony_ci		first_node = false;
5488c2ecf20Sopenharmony_ci
5498c2ecf20Sopenharmony_ci		first_col = true;
5508c2ecf20Sopenharmony_ci		perf_hpp_list__for_each_format(&fmt_node->hpp ,fmt) {
5518c2ecf20Sopenharmony_ci			if (perf_hpp__should_skip(fmt, hists))
5528c2ecf20Sopenharmony_ci				continue;
5538c2ecf20Sopenharmony_ci
5548c2ecf20Sopenharmony_ci			if (!first_col)
5558c2ecf20Sopenharmony_ci				strcat(buf, "+");
5568c2ecf20Sopenharmony_ci			first_col = false;
5578c2ecf20Sopenharmony_ci
5588c2ecf20Sopenharmony_ci			fmt->header(fmt, &hpp, hists, 0, NULL);
5598c2ecf20Sopenharmony_ci			strcat(buf, strim(hpp.buf));
5608c2ecf20Sopenharmony_ci		}
5618c2ecf20Sopenharmony_ci	}
5628c2ecf20Sopenharmony_ci
5638c2ecf20Sopenharmony_ci	gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(view),
5648c2ecf20Sopenharmony_ci						    -1, buf,
5658c2ecf20Sopenharmony_ci						    renderer, "markup",
5668c2ecf20Sopenharmony_ci						    col_idx++, NULL);
5678c2ecf20Sopenharmony_ci
5688c2ecf20Sopenharmony_ci	for (col_idx = 0; col_idx < nr_cols; col_idx++) {
5698c2ecf20Sopenharmony_ci		GtkTreeViewColumn *column;
5708c2ecf20Sopenharmony_ci
5718c2ecf20Sopenharmony_ci		column = gtk_tree_view_get_column(GTK_TREE_VIEW(view), col_idx);
5728c2ecf20Sopenharmony_ci		gtk_tree_view_column_set_resizable(column, TRUE);
5738c2ecf20Sopenharmony_ci
5748c2ecf20Sopenharmony_ci		if (col_idx == 0) {
5758c2ecf20Sopenharmony_ci			gtk_tree_view_set_expander_column(GTK_TREE_VIEW(view),
5768c2ecf20Sopenharmony_ci							  column);
5778c2ecf20Sopenharmony_ci		}
5788c2ecf20Sopenharmony_ci	}
5798c2ecf20Sopenharmony_ci
5808c2ecf20Sopenharmony_ci	gtk_tree_view_set_model(GTK_TREE_VIEW(view), GTK_TREE_MODEL(store));
5818c2ecf20Sopenharmony_ci	g_object_unref(GTK_TREE_MODEL(store));
5828c2ecf20Sopenharmony_ci
5838c2ecf20Sopenharmony_ci	perf_gtk__add_hierarchy_entries(hists, &hists->entries, store,
5848c2ecf20Sopenharmony_ci					NULL, &hpp, min_pcnt);
5858c2ecf20Sopenharmony_ci
5868c2ecf20Sopenharmony_ci	gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(view), TRUE);
5878c2ecf20Sopenharmony_ci
5888c2ecf20Sopenharmony_ci	g_signal_connect(view, "row-activated",
5898c2ecf20Sopenharmony_ci			 G_CALLBACK(on_row_activated), NULL);
5908c2ecf20Sopenharmony_ci	gtk_container_add(GTK_CONTAINER(window), view);
5918c2ecf20Sopenharmony_ci}
5928c2ecf20Sopenharmony_ci
5938c2ecf20Sopenharmony_ciint perf_evlist__gtk_browse_hists(struct evlist *evlist,
5948c2ecf20Sopenharmony_ci				  const char *help,
5958c2ecf20Sopenharmony_ci				  struct hist_browser_timer *hbt __maybe_unused,
5968c2ecf20Sopenharmony_ci				  float min_pcnt)
5978c2ecf20Sopenharmony_ci{
5988c2ecf20Sopenharmony_ci	struct evsel *pos;
5998c2ecf20Sopenharmony_ci	GtkWidget *vbox;
6008c2ecf20Sopenharmony_ci	GtkWidget *notebook;
6018c2ecf20Sopenharmony_ci	GtkWidget *info_bar;
6028c2ecf20Sopenharmony_ci	GtkWidget *statbar;
6038c2ecf20Sopenharmony_ci	GtkWidget *window;
6048c2ecf20Sopenharmony_ci
6058c2ecf20Sopenharmony_ci	signal(SIGSEGV, perf_gtk__signal);
6068c2ecf20Sopenharmony_ci	signal(SIGFPE,  perf_gtk__signal);
6078c2ecf20Sopenharmony_ci	signal(SIGINT,  perf_gtk__signal);
6088c2ecf20Sopenharmony_ci	signal(SIGQUIT, perf_gtk__signal);
6098c2ecf20Sopenharmony_ci	signal(SIGTERM, perf_gtk__signal);
6108c2ecf20Sopenharmony_ci
6118c2ecf20Sopenharmony_ci	window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
6128c2ecf20Sopenharmony_ci
6138c2ecf20Sopenharmony_ci	gtk_window_set_title(GTK_WINDOW(window), "perf report");
6148c2ecf20Sopenharmony_ci
6158c2ecf20Sopenharmony_ci	g_signal_connect(window, "delete_event", gtk_main_quit, NULL);
6168c2ecf20Sopenharmony_ci
6178c2ecf20Sopenharmony_ci	pgctx = perf_gtk__activate_context(window);
6188c2ecf20Sopenharmony_ci	if (!pgctx)
6198c2ecf20Sopenharmony_ci		return -1;
6208c2ecf20Sopenharmony_ci
6218c2ecf20Sopenharmony_ci	vbox = gtk_vbox_new(FALSE, 0);
6228c2ecf20Sopenharmony_ci
6238c2ecf20Sopenharmony_ci	notebook = gtk_notebook_new();
6248c2ecf20Sopenharmony_ci
6258c2ecf20Sopenharmony_ci	gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0);
6268c2ecf20Sopenharmony_ci
6278c2ecf20Sopenharmony_ci	info_bar = perf_gtk__setup_info_bar();
6288c2ecf20Sopenharmony_ci	if (info_bar)
6298c2ecf20Sopenharmony_ci		gtk_box_pack_start(GTK_BOX(vbox), info_bar, FALSE, FALSE, 0);
6308c2ecf20Sopenharmony_ci
6318c2ecf20Sopenharmony_ci	statbar = perf_gtk__setup_statusbar();
6328c2ecf20Sopenharmony_ci	gtk_box_pack_start(GTK_BOX(vbox), statbar, FALSE, FALSE, 0);
6338c2ecf20Sopenharmony_ci
6348c2ecf20Sopenharmony_ci	gtk_container_add(GTK_CONTAINER(window), vbox);
6358c2ecf20Sopenharmony_ci
6368c2ecf20Sopenharmony_ci	evlist__for_each_entry(evlist, pos) {
6378c2ecf20Sopenharmony_ci		struct hists *hists = evsel__hists(pos);
6388c2ecf20Sopenharmony_ci		const char *evname = evsel__name(pos);
6398c2ecf20Sopenharmony_ci		GtkWidget *scrolled_window;
6408c2ecf20Sopenharmony_ci		GtkWidget *tab_label;
6418c2ecf20Sopenharmony_ci		char buf[512];
6428c2ecf20Sopenharmony_ci		size_t size = sizeof(buf);
6438c2ecf20Sopenharmony_ci
6448c2ecf20Sopenharmony_ci		if (symbol_conf.event_group) {
6458c2ecf20Sopenharmony_ci			if (!evsel__is_group_leader(pos))
6468c2ecf20Sopenharmony_ci				continue;
6478c2ecf20Sopenharmony_ci
6488c2ecf20Sopenharmony_ci			if (pos->core.nr_members > 1) {
6498c2ecf20Sopenharmony_ci				evsel__group_desc(pos, buf, size);
6508c2ecf20Sopenharmony_ci				evname = buf;
6518c2ecf20Sopenharmony_ci			}
6528c2ecf20Sopenharmony_ci		}
6538c2ecf20Sopenharmony_ci
6548c2ecf20Sopenharmony_ci		scrolled_window = gtk_scrolled_window_new(NULL, NULL);
6558c2ecf20Sopenharmony_ci
6568c2ecf20Sopenharmony_ci		gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window),
6578c2ecf20Sopenharmony_ci							GTK_POLICY_AUTOMATIC,
6588c2ecf20Sopenharmony_ci							GTK_POLICY_AUTOMATIC);
6598c2ecf20Sopenharmony_ci
6608c2ecf20Sopenharmony_ci		if (symbol_conf.report_hierarchy)
6618c2ecf20Sopenharmony_ci			perf_gtk__show_hierarchy(scrolled_window, hists, min_pcnt);
6628c2ecf20Sopenharmony_ci		else
6638c2ecf20Sopenharmony_ci			perf_gtk__show_hists(scrolled_window, hists, min_pcnt);
6648c2ecf20Sopenharmony_ci
6658c2ecf20Sopenharmony_ci		tab_label = gtk_label_new(evname);
6668c2ecf20Sopenharmony_ci
6678c2ecf20Sopenharmony_ci		gtk_notebook_append_page(GTK_NOTEBOOK(notebook), scrolled_window, tab_label);
6688c2ecf20Sopenharmony_ci	}
6698c2ecf20Sopenharmony_ci
6708c2ecf20Sopenharmony_ci	gtk_widget_show_all(window);
6718c2ecf20Sopenharmony_ci
6728c2ecf20Sopenharmony_ci	perf_gtk__resize_window(window);
6738c2ecf20Sopenharmony_ci
6748c2ecf20Sopenharmony_ci	gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
6758c2ecf20Sopenharmony_ci
6768c2ecf20Sopenharmony_ci	ui_helpline__push(help);
6778c2ecf20Sopenharmony_ci
6788c2ecf20Sopenharmony_ci	gtk_main();
6798c2ecf20Sopenharmony_ci
6808c2ecf20Sopenharmony_ci	perf_gtk__deactivate_context(&pgctx);
6818c2ecf20Sopenharmony_ci
6828c2ecf20Sopenharmony_ci	return 0;
6838c2ecf20Sopenharmony_ci}
684