sysprof: bring back Hits column for descendants

This is helpful because it lets you know how reliable your percentages are.
This commit is contained in:
Christian Hergert
2023-07-31 13:30:00 -07:00
parent aaafa8e9ef
commit fa1c88eaf9
2 changed files with 50 additions and 0 deletions

View File

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

View File

@ -63,6 +63,36 @@
</property>
</object>
</child>
<child>
<object class="GtkColumnViewColumn" id="descendants_hits_column">
<property name="title" translatable="yes">Hits</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="GtkLabel" id="progress">
<property name="xalign">1</property>
<binding name="label">
<closure type="gint64" function="get_total_hits">
<lookup name="item">GtkListItem</lookup>
</closure>
</binding>
<attributes>
<attribute name="scale" value=".9"/>
</attributes>
</object>
</property>
</template>
</interface>
]]>
</property>
</object>
</property>
</object>
</child>
</object>
</child>
<child internal-child="functions_column_view">