From 787d02353e207ccd15907ad01d3bd4a039be9ba1 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Fri, 14 Jul 2023 15:18:39 -0700 Subject: [PATCH] sysprof: add indicator to allocations section --- src/sysprof/sysprof-memory-section.c | 10 ++++++++++ src/sysprof/sysprof-memory-section.ui | 11 +++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/sysprof/sysprof-memory-section.c b/src/sysprof/sysprof-memory-section.c index 1281e96e..ba4d237b 100644 --- a/src/sysprof/sysprof-memory-section.c +++ b/src/sysprof/sysprof-memory-section.c @@ -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); diff --git a/src/sysprof/sysprof-memory-section.ui b/src/sysprof/sysprof-memory-section.ui index eb688dce..17b2a085 100644 --- a/src/sysprof/sysprof-memory-section.ui +++ b/src/sysprof/sysprof-memory-section.ui @@ -2,6 +2,17 @@