From 7cd51d15023409f99c7bcaa00fac9af5646e33d1 Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Wed, 7 Aug 2024 11:18:03 -0300 Subject: [PATCH] sysprof: show mark name in waterfall marks This makes is much easier to inspect waterfall marks, since we can spot at a glance which marks are there, without having to hover each mark individually with the cursor to see the tooltip. This helps WebKit profiling in particular, which is a heavy user of marks. --- src/sysprof/sysprof-marks-section.c | 20 ++++++++++++++++++++ src/sysprof/sysprof-marks-section.ui | 4 ++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/sysprof/sysprof-marks-section.c b/src/sysprof/sysprof-marks-section.c index 9ee2af91..57e52581 100644 --- a/src/sysprof/sysprof-marks-section.c +++ b/src/sysprof/sysprof-marks-section.c @@ -42,6 +42,25 @@ struct _SysprofMarksSection G_DEFINE_FINAL_TYPE (SysprofMarksSection, sysprof_marks_section, SYSPROF_TYPE_SECTION) +static char * +format_mark_label (gpointer unused, + SysprofDocumentMark *mark) +{ + const char *message; + const char *name; + + if (mark == NULL) + return NULL; + + name = sysprof_document_mark_get_name (mark); + message = sysprof_document_mark_get_message (mark); + + if (name && *name && message && *message) + return g_strdup_printf ("%s – %s", name, message); + else + return g_strdup_printf ("%s", name); +} + static char * format_number (gpointer unused, guint number) @@ -74,6 +93,7 @@ sysprof_marks_section_class_init (SysprofMarksSectionClass *klass) gtk_widget_class_bind_template_child (widget_class, SysprofMarksSection, mark_table); gtk_widget_class_bind_template_child (widget_class, SysprofMarksSection, median_column); gtk_widget_class_bind_template_child (widget_class, SysprofMarksSection, summary_column_view); + gtk_widget_class_bind_template_callback (widget_class, format_mark_label); gtk_widget_class_bind_template_callback (widget_class, format_number); g_type_ensure (SYSPROF_TYPE_CHART); diff --git a/src/sysprof/sysprof-marks-section.ui b/src/sysprof/sysprof-marks-section.ui index 2dbe40b3..48a927e8 100644 --- a/src/sysprof/sysprof-marks-section.ui +++ b/src/sysprof/sysprof-marks-section.ui @@ -175,9 +175,9 @@ - + - +