From fa1c88eaf929a1261b9f663da79e919b8365e576 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Mon, 31 Jul 2023 13:30:00 -0700 Subject: [PATCH] sysprof: bring back Hits column for descendants This is helpful because it lets you know how reliable your percentages are. --- src/sysprof/sysprof-weighted-callgraph-view.c | 20 +++++++++++++ .../sysprof-weighted-callgraph-view.ui | 30 +++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/src/sysprof/sysprof-weighted-callgraph-view.c b/src/sysprof/sysprof-weighted-callgraph-view.c index c2b4dacb..dab3883c 100644 --- a/src/sysprof/sysprof-weighted-callgraph-view.c +++ b/src/sysprof/sysprof-weighted-callgraph-view.c @@ -98,6 +98,25 @@ augment_weight (SysprofCallgraph *callgraph, } } +static gint64 +get_total_hits (GObject *item) +{ + g_autoptr(GObject) row = NULL; + + g_object_get (item, "item", &row, NULL); + + if (GTK_IS_TREE_LIST_ROW (row)) + { + GtkTreeListRow *tree_row = GTK_TREE_LIST_ROW (row); + SysprofCallgraphFrame *frame = SYSPROF_CALLGRAPH_FRAME (gtk_tree_list_row_get_item (tree_row)); + AugmentWeight *sum = sysprof_callgraph_frame_get_augment (frame); + + return sum->total; + } + + return 0; +} + static double get_total_fraction (GObject *item) { @@ -329,6 +348,7 @@ sysprof_weighted_callgraph_view_class_init (SysprofWeightedCallgraphViewClass *k gtk_widget_class_bind_template_callback (widget_class, get_self_fraction); gtk_widget_class_bind_template_callback (widget_class, get_total_fraction); + gtk_widget_class_bind_template_callback (widget_class, get_total_hits); gtk_widget_class_bind_template_callback (widget_class, functions_get_self_fraction); gtk_widget_class_bind_template_callback (widget_class, functions_get_total_fraction); diff --git a/src/sysprof/sysprof-weighted-callgraph-view.ui b/src/sysprof/sysprof-weighted-callgraph-view.ui index 3d9c34c4..cb29ed96 100644 --- a/src/sysprof/sysprof-weighted-callgraph-view.ui +++ b/src/sysprof/sysprof-weighted-callgraph-view.ui @@ -63,6 +63,36 @@ + + + Hits + + + + + + +]]> + + + + +