From 4e9615571b8ce3c9cf3e0fb7d33ed285fd826b35 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Mon, 12 Jun 2023 12:01:33 -0700 Subject: [PATCH] libsysprof-gtk: add columns for callers list --- src/libsysprof-gtk/sysprof-callgraph-view.c | 4 +- .../sysprof-weighted-callgraph-view.c | 18 +++++ .../sysprof-weighted-callgraph-view.ui | 67 +++++++++++++++++++ 3 files changed, 88 insertions(+), 1 deletion(-) diff --git a/src/libsysprof-gtk/sysprof-callgraph-view.c b/src/libsysprof-gtk/sysprof-callgraph-view.c index e0c27513..933f6c2a 100644 --- a/src/libsysprof-gtk/sysprof-callgraph-view.c +++ b/src/libsysprof-gtk/sysprof-callgraph-view.c @@ -383,7 +383,9 @@ sysprof_callgraph_view_get_internal_child (GtkBuildable *buildable, GtkBuilder *builder, const char *name) { - if (g_strcmp0 (name, "descendants_column_view") == 0) + if (g_strcmp0 (name, "callers_column_view") == 0) + return G_OBJECT (SYSPROF_CALLGRAPH_VIEW (buildable)->callers_column_view); + else if (g_strcmp0 (name, "descendants_column_view") == 0) return G_OBJECT (SYSPROF_CALLGRAPH_VIEW (buildable)->descendants_column_view); else if (g_strcmp0 (name, "functions_column_view") == 0) return G_OBJECT (SYSPROF_CALLGRAPH_VIEW (buildable)->functions_column_view); diff --git a/src/libsysprof-gtk/sysprof-weighted-callgraph-view.c b/src/libsysprof-gtk/sysprof-weighted-callgraph-view.c index 098213a2..e1cfa7e6 100644 --- a/src/libsysprof-gtk/sysprof-weighted-callgraph-view.c +++ b/src/libsysprof-gtk/sysprof-weighted-callgraph-view.c @@ -28,6 +28,11 @@ struct _SysprofWeightedCallgraphView { SysprofCallgraphView parent_instance; + GtkColumnViewColumn *callers_self_column; + GtkColumnViewColumn *callers_total_column; + GtkCustomSorter *callers_self_sorter; + GtkCustomSorter *callers_total_sorter; + GtkColumnViewColumn *descendants_self_column; GtkColumnViewColumn *descendants_total_column; GtkCustomSorter *descendants_self_sorter; @@ -272,6 +277,14 @@ sysprof_weighted_callgraph_view_load (SysprofCallgraphView *view, gtk_custom_sorter_set_sort_func (self->functions_total_sorter, functions_sort_by_total, root, NULL); + gtk_custom_sorter_set_sort_func (self->callers_self_sorter, + functions_sort_by_self, root, NULL); + gtk_custom_sorter_set_sort_func (self->callers_total_sorter, + functions_sort_by_total, root, NULL); + + gtk_column_view_sort_by_column (SYSPROF_CALLGRAPH_VIEW (self)->callers_column_view, + self->callers_total_column, + GTK_SORT_DESCENDING); gtk_column_view_sort_by_column (SYSPROF_CALLGRAPH_VIEW (self)->descendants_column_view, self->descendants_total_column, GTK_SORT_DESCENDING); @@ -292,6 +305,11 @@ sysprof_weighted_callgraph_view_class_init (SysprofWeightedCallgraphViewClass *k gtk_widget_class_set_template_from_resource (widget_class, "/libsysprof-gtk/sysprof-weighted-callgraph-view.ui"); + gtk_widget_class_bind_template_child (widget_class, SysprofWeightedCallgraphView, callers_self_column); + gtk_widget_class_bind_template_child (widget_class, SysprofWeightedCallgraphView, callers_total_column); + gtk_widget_class_bind_template_child (widget_class, SysprofWeightedCallgraphView, callers_self_sorter); + gtk_widget_class_bind_template_child (widget_class, SysprofWeightedCallgraphView, callers_total_sorter); + gtk_widget_class_bind_template_child (widget_class, SysprofWeightedCallgraphView, descendants_self_column); gtk_widget_class_bind_template_child (widget_class, SysprofWeightedCallgraphView, descendants_total_column); gtk_widget_class_bind_template_child (widget_class, SysprofWeightedCallgraphView, descendants_self_sorter); diff --git a/src/libsysprof-gtk/sysprof-weighted-callgraph-view.ui b/src/libsysprof-gtk/sysprof-weighted-callgraph-view.ui index 99c50d63..3d9c34c4 100644 --- a/src/libsysprof-gtk/sysprof-weighted-callgraph-view.ui +++ b/src/libsysprof-gtk/sysprof-weighted-callgraph-view.ui @@ -132,5 +132,72 @@ + + + + + + Self + + + + + + +]]> + + + + + + + + + + + + Total + + + + + + +]]> + + + + + + + + + + +