libsysprof-gtk: add columns for callers list

This commit is contained in:
Christian Hergert
2023-06-12 12:01:33 -07:00
parent ff1edcc8c9
commit 4e9615571b
3 changed files with 88 additions and 1 deletions

View File

@ -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);

View File

@ -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);

View File

@ -132,5 +132,72 @@
</child>
</object>
</child>
<child internal-child="callers_column_view">
<object class="GtkColumnView">
<style>
<class name="data-table"/>
</style>
<child>
<object class="GtkColumnViewColumn" id="callers_self_column">
<property name="title" translatable="yes">Self</property>
<property name="factory">
<object class="GtkBuilderListItemFactory">
<property name="bytes"><![CDATA[
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="GtkListItem">
<property name="child">
<object class="SysprofProgressCell" id="progress">
<binding name="fraction">
<closure type="gdouble" function="functions_get_self_fraction">
<lookup name="item">GtkListItem</lookup>
</closure>
</binding>
</object>
</property>
</template>
</interface>
]]>
</property>
</object>
</property>
<property name="sorter">
<object class="GtkCustomSorter" id="callers_self_sorter">
</object>
</property>
</object>
</child>
<child>
<object class="GtkColumnViewColumn" id="callers_total_column">
<property name="title" translatable="yes">Total</property>
<property name="factory">
<object class="GtkBuilderListItemFactory">
<property name="bytes"><![CDATA[
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="GtkListItem">
<property name="child">
<object class="SysprofProgressCell" id="progress">
<binding name="fraction">
<closure type="gdouble" function="functions_get_total_fraction">
<lookup name="item">GtkListItem</lookup>
</closure>
</binding>
</object>
</property>
</template>
</interface>
]]>
</property>
</object>
</property>
<property name="sorter">
<object class="GtkCustomSorter" id="callers_total_sorter">
</object>
</property>
</object>
</child>
</object>
</child>
</template>
</interface>