sysprof: add indicator to allocations section

This commit is contained in:
Christian Hergert
2023-07-14 15:18:39 -07:00
parent 83681b2ee3
commit 787d02353e
2 changed files with 21 additions and 0 deletions

View File

@ -33,6 +33,15 @@ struct _SysprofMemorySection
G_DEFINE_FINAL_TYPE (SysprofMemorySection, sysprof_memory_section, SYSPROF_TYPE_SECTION)
static char *
format_number (gpointer unused,
guint number)
{
if (number == 0)
return NULL;
return g_strdup_printf ("%'u", number);
}
static void
sysprof_memory_section_dispose (GObject *object)
{
@ -53,6 +62,7 @@ sysprof_memory_section_class_init (SysprofMemorySectionClass *klass)
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/sysprof/sysprof-memory-section.ui");
gtk_widget_class_bind_template_child (widget_class, SysprofMemorySection, callgraph_view);
gtk_widget_class_bind_template_callback (widget_class, format_number);
g_type_ensure (SYSPROF_TYPE_CHART);
g_type_ensure (SYSPROF_TYPE_XY_SERIES);

View File

@ -2,6 +2,17 @@
<interface>
<template class="SysprofMemorySection" parent="SysprofSection">
<property name="title" translatable="yes">Memory Allocations</property>
<binding name="indicator">
<closure type="gchararray" function="format_number">
<lookup name="n-items" type="SysprofDocumentBitsetIndex">
<lookup name="allocations" type="SysprofDocument">
<lookup name="document" type="SysprofSession">
<lookup name="session">SysprofMemorySection</lookup>
</lookup>
</lookup>
</lookup>
</closure>
</binding>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>