sysprof: add summary of marks with avg/min/max/median

This commit is contained in:
Christian Hergert
2023-07-22 16:41:41 -07:00
parent 91d48b87d6
commit 861d78dfd1
2 changed files with 256 additions and 4 deletions

View File

@ -31,10 +31,12 @@
struct _SysprofMarksSection
{
SysprofSection parent_instance;
SysprofSection parent_instance;
SysprofMarkChart *mark_chart;
SysprofMarkTable *mark_table;
SysprofMarkChart *mark_chart;
SysprofMarkTable *mark_table;
GtkColumnView *summary_column_view;
GtkColumnViewColumn *median_column;
};
G_DEFINE_FINAL_TYPE (SysprofMarksSection, sysprof_marks_section, SYSPROF_TYPE_SECTION)
@ -69,10 +71,13 @@ sysprof_marks_section_class_init (SysprofMarksSectionClass *klass)
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/sysprof/sysprof-marks-section.ui");
gtk_widget_class_bind_template_child (widget_class, SysprofMarksSection, mark_chart);
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_number);
g_type_ensure (SYSPROF_TYPE_CHART);
g_type_ensure (SYSPROF_TYPE_DOCUMENT_MARK);
g_type_ensure (SYSPROF_TYPE_MARK_CATALOG);
g_type_ensure (SYSPROF_TYPE_MARK_CHART);
g_type_ensure (SYSPROF_TYPE_MARK_TABLE);
g_type_ensure (SYSPROF_TYPE_SESSION_MODEL);
@ -85,4 +90,8 @@ static void
sysprof_marks_section_init (SysprofMarksSection *self)
{
gtk_widget_init_template (GTK_WIDGET (self));
gtk_column_view_sort_by_column (self->summary_column_view,
self->median_column,
GTK_SORT_DESCENDING);
}

View File

@ -196,6 +196,250 @@
</property>
</object>
</child>
<child>
<object class="AdwViewStackPage">
<property name="title" translatable="yes">Summary</property>
<property name="icon-name">info-symbolic</property>
<property name="child">
<object class="GtkScrolledWindow">
<child>
<object class="GtkColumnView" id="summary_column_view">
<style>
<class name="data-table"/>
</style>
<property name="model">
<object class="GtkNoSelection">
<property name="model">
<object class="GtkSortListModel">
<binding name="sorter">
<lookup name="sorter">summary_column_view</lookup>
</binding>
<!-- it might be nice to update these by selection -->
<property name="model">
<object class="GtkFlattenListModel">
<binding name="model">
<lookup name="marks-catalog" type="SysprofDocument">
<lookup name="document" type="SysprofSession">
<lookup name="session">SysprofMarksSection</lookup>
</lookup>
</lookup>
</binding>
</object>
</property>
</object>
</property>
</object>
</property>
<child>
<object class="GtkColumnViewColumn">
<property name="title" translatable="yes">Category</property>
<property name="sorter">
<object class="GtkStringSorter">
<property name="expression">
<lookup name="group" type="SysprofMarkCatalog"/>
</property>
</object>
</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">
<property name="xalign">0</property>
<binding name="label">
<lookup name="group" type="SysprofMarkCatalog">
<lookup name="item">GtkListItem</lookup>
</lookup>
</binding>
</object>
</property>
</template>
</interface>
]]>
</property>
</object>
</property>
</object>
</child>
<child>
<object class="GtkColumnViewColumn">
<property name="title" translatable="yes">Name</property>
<property name="sorter">
<object class="GtkStringSorter">
<property name="expression">
<lookup name="name" type="SysprofMarkCatalog"/>
</property>
</object>
</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">
<property name="xalign">0</property>
<binding name="label">
<lookup name="name" type="SysprofMarkCatalog">
<lookup name="item">GtkListItem</lookup>
</lookup>
</binding>
</object>
</property>
</template>
</interface>
]]>
</property>
</object>
</property>
</object>
</child>
<child>
<object class="GtkColumnViewColumn">
<property name="title" translatable="yes">Minimum</property>
<property name="sorter">
<object class="GtkNumericSorter">
<property name="expression">
<lookup name="min-duration" type="SysprofMarkCatalog"/>
</property>
</object>
</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="SysprofTimeLabel">
<property name="show-zero">false</property>
<binding name="duration">
<lookup name="min-duration" type="SysprofMarkCatalog">
<lookup name="item">GtkListItem</lookup>
</lookup>
</binding>
</object>
</property>
</template>
</interface>
]]>
</property>
</object>
</property>
</object>
</child>
<child>
<object class="GtkColumnViewColumn">
<property name="title" translatable="yes">Maximum</property>
<property name="sorter">
<object class="GtkNumericSorter">
<property name="expression">
<lookup name="max-duration" type="SysprofMarkCatalog"/>
</property>
</object>
</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="SysprofTimeLabel">
<property name="show-zero">false</property>
<binding name="duration">
<lookup name="max-duration" type="SysprofMarkCatalog">
<lookup name="item">GtkListItem</lookup>
</lookup>
</binding>
</object>
</property>
</template>
</interface>
]]>
</property>
</object>
</property>
</object>
</child>
<child>
<object class="GtkColumnViewColumn">
<property name="title" translatable="yes">Average</property>
<property name="sorter">
<object class="GtkNumericSorter">
<property name="expression">
<lookup name="average-duration" type="SysprofMarkCatalog"/>
</property>
</object>
</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="SysprofTimeLabel">
<property name="show-zero">false</property>
<binding name="duration">
<lookup name="average-duration" type="SysprofMarkCatalog">
<lookup name="item">GtkListItem</lookup>
</lookup>
</binding>
</object>
</property>
</template>
</interface>
]]>
</property>
</object>
</property>
</object>
</child>
<child>
<object class="GtkColumnViewColumn" id="median_column">
<property name="title" translatable="yes">Median</property>
<property name="sorter">
<object class="GtkNumericSorter">
<property name="expression">
<lookup name="median-duration" type="SysprofMarkCatalog"/>
</property>
</object>
</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="SysprofTimeLabel">
<property name="show-zero">false</property>
<binding name="duration">
<lookup name="median-duration" type="SysprofMarkCatalog">
<lookup name="item">GtkListItem</lookup>
</lookup>
</binding>
</object>
</property>
</template>
</interface>
]]>
</property>
</object>
</property>
</object>
</child>
</object>
</child>
</object>
</property>
</object>
</child>
</object>
</child>
<child>
@ -208,4 +452,3 @@
</child>
</template>
</interface>