From 9cbfc2136390060d39ae8fcad807cfae7954a985 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Sun, 6 Aug 2023 02:11:36 -0700 Subject: [PATCH] sysprof: add allocated size column to memory callgraph --- src/sysprof/sysprof-memory-callgraph-view.c | 20 +++++++++++++ src/sysprof/sysprof-memory-callgraph-view.ui | 30 ++++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/src/sysprof/sysprof-memory-callgraph-view.c b/src/sysprof/sysprof-memory-callgraph-view.c index ebc800f4..14972509 100644 --- a/src/sysprof/sysprof-memory-callgraph-view.c +++ b/src/sysprof/sysprof-memory-callgraph-view.c @@ -318,6 +318,25 @@ sysprof_memory_callgraph_view_load (SysprofCallgraphView *view, GTK_SORT_DESCENDING); } +static char * +get_total_size (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)); + AugmentMemory *sum = sysprof_callgraph_frame_get_augment (frame); + + return g_format_size (sum->total); + } + + return NULL; +} + static void sysprof_memory_callgraph_view_class_init (SysprofMemoryCallgraphViewClass *klass) { @@ -347,6 +366,7 @@ sysprof_memory_callgraph_view_class_init (SysprofMemoryCallgraphViewClass *klass 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_size); 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-memory-callgraph-view.ui b/src/sysprof/sysprof-memory-callgraph-view.ui index 0efb97ac..29a719db 100644 --- a/src/sysprof/sysprof-memory-callgraph-view.ui +++ b/src/sysprof/sysprof-memory-callgraph-view.ui @@ -63,6 +63,36 @@ + + + Size + + + + + + +]]> + + + + +