mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-12 16:10:54 +00:00
sysprof: generate summaries and display in utility pane
This commit is contained in:
@ -37,6 +37,7 @@ struct _SysprofCallgraphView
|
|||||||
GSignalGroup *traceables_signals;
|
GSignalGroup *traceables_signals;
|
||||||
GListModel *traceables;
|
GListModel *traceables;
|
||||||
GListModel *utility_traceables;
|
GListModel *utility_traceables;
|
||||||
|
GListModel *utility_summary;
|
||||||
|
|
||||||
GtkColumnView *callers_column_view;
|
GtkColumnView *callers_column_view;
|
||||||
GtkColumnView *descendants_column_view;
|
GtkColumnView *descendants_column_view;
|
||||||
|
|||||||
@ -38,6 +38,7 @@ enum {
|
|||||||
PROP_HIDE_SYSTEM_LIBRARIES,
|
PROP_HIDE_SYSTEM_LIBRARIES,
|
||||||
PROP_INCLUDE_THREADS,
|
PROP_INCLUDE_THREADS,
|
||||||
PROP_TRACEABLES,
|
PROP_TRACEABLES,
|
||||||
|
PROP_UTILITY_SUMMARY,
|
||||||
PROP_UTILITY_TRACEABLES,
|
PROP_UTILITY_TRACEABLES,
|
||||||
N_PROPS
|
N_PROPS
|
||||||
};
|
};
|
||||||
@ -67,6 +68,17 @@ sysprof_callgraph_view_set_utility_traceables (SysprofCallgraphView *self,
|
|||||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_UTILITY_TRACEABLES]);
|
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_UTILITY_TRACEABLES]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
sysprof_callgraph_view_set_utility_summary (SysprofCallgraphView *self,
|
||||||
|
GListModel *model)
|
||||||
|
{
|
||||||
|
g_assert (SYSPROF_IS_CALLGRAPH_VIEW (self));
|
||||||
|
g_assert (!model || G_IS_LIST_MODEL (model));
|
||||||
|
|
||||||
|
if (g_set_object (&self->utility_summary, model))
|
||||||
|
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_UTILITY_SUMMARY]);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sysprof_callgraph_view_set_descendants (SysprofCallgraphView *self,
|
sysprof_callgraph_view_set_descendants (SysprofCallgraphView *self,
|
||||||
GListModel *model)
|
GListModel *model)
|
||||||
@ -167,6 +179,25 @@ sysprof_callgraph_view_list_traceables_cb (GObject *object,
|
|||||||
sysprof_callgraph_view_set_utility_traceables (self, model);
|
sysprof_callgraph_view_set_utility_traceables (self, model);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
sysprof_callgraph_view_summarize_cb (GObject *object,
|
||||||
|
GAsyncResult *result,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
SysprofCallgraphFrame *frame = (SysprofCallgraphFrame *)object;
|
||||||
|
g_autoptr(SysprofCallgraphView) self = user_data;
|
||||||
|
g_autoptr(GListModel) model = NULL;
|
||||||
|
g_autoptr(GError) error = NULL;
|
||||||
|
|
||||||
|
g_assert (SYSPROF_IS_CALLGRAPH_FRAME (frame));
|
||||||
|
g_assert (G_IS_ASYNC_RESULT (result));
|
||||||
|
g_assert (SYSPROF_IS_CALLGRAPH_VIEW (self));
|
||||||
|
|
||||||
|
model = sysprof_callgraph_frame_summarize_finish (frame, result, &error);
|
||||||
|
|
||||||
|
sysprof_callgraph_view_set_utility_summary (self, model);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
descendants_selection_changed_cb (SysprofCallgraphView *self,
|
descendants_selection_changed_cb (SysprofCallgraphView *self,
|
||||||
guint position,
|
guint position,
|
||||||
@ -179,16 +210,23 @@ descendants_selection_changed_cb (SysprofCallgraphView *self,
|
|||||||
g_assert (SYSPROF_IS_CALLGRAPH_VIEW (self));
|
g_assert (SYSPROF_IS_CALLGRAPH_VIEW (self));
|
||||||
g_assert (GTK_IS_SINGLE_SELECTION (single));
|
g_assert (GTK_IS_SINGLE_SELECTION (single));
|
||||||
|
|
||||||
|
sysprof_callgraph_view_set_utility_summary (self, NULL);
|
||||||
sysprof_callgraph_view_set_utility_traceables (self, NULL);
|
sysprof_callgraph_view_set_utility_traceables (self, NULL);
|
||||||
|
|
||||||
if ((object = gtk_single_selection_get_selected_item (single)) &&
|
if ((object = gtk_single_selection_get_selected_item (single)) &&
|
||||||
GTK_IS_TREE_LIST_ROW (object) &&
|
GTK_IS_TREE_LIST_ROW (object) &&
|
||||||
(item = gtk_tree_list_row_get_item (GTK_TREE_LIST_ROW (object))) &&
|
(item = gtk_tree_list_row_get_item (GTK_TREE_LIST_ROW (object))) &&
|
||||||
SYSPROF_IS_CALLGRAPH_FRAME (item))
|
SYSPROF_IS_CALLGRAPH_FRAME (item))
|
||||||
sysprof_callgraph_frame_list_traceables_async (SYSPROF_CALLGRAPH_FRAME (item),
|
{
|
||||||
NULL,
|
sysprof_callgraph_frame_summarize_async (SYSPROF_CALLGRAPH_FRAME (item),
|
||||||
sysprof_callgraph_view_list_traceables_cb,
|
NULL,
|
||||||
g_object_ref (self));
|
sysprof_callgraph_view_summarize_cb,
|
||||||
|
g_object_ref (self));
|
||||||
|
sysprof_callgraph_frame_list_traceables_async (SYSPROF_CALLGRAPH_FRAME (item),
|
||||||
|
NULL,
|
||||||
|
sysprof_callgraph_view_list_traceables_cb,
|
||||||
|
g_object_ref (self));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -305,6 +343,7 @@ sysprof_callgraph_view_dispose (GObject *object)
|
|||||||
g_clear_object (&self->callgraph);
|
g_clear_object (&self->callgraph);
|
||||||
g_clear_object (&self->document);
|
g_clear_object (&self->document);
|
||||||
g_clear_object (&self->traceables);
|
g_clear_object (&self->traceables);
|
||||||
|
g_clear_object (&self->utility_summary);
|
||||||
g_clear_object (&self->utility_traceables);
|
g_clear_object (&self->utility_traceables);
|
||||||
|
|
||||||
G_OBJECT_CLASS (sysprof_callgraph_view_parent_class)->dispose (object);
|
G_OBJECT_CLASS (sysprof_callgraph_view_parent_class)->dispose (object);
|
||||||
@ -348,6 +387,10 @@ sysprof_callgraph_view_get_property (GObject *object,
|
|||||||
g_value_set_object (value, sysprof_callgraph_view_get_traceables (self));
|
g_value_set_object (value, sysprof_callgraph_view_get_traceables (self));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROP_UTILITY_SUMMARY:
|
||||||
|
g_value_set_object (value, self->utility_summary);
|
||||||
|
break;
|
||||||
|
|
||||||
case PROP_UTILITY_TRACEABLES:
|
case PROP_UTILITY_TRACEABLES:
|
||||||
g_value_set_object (value, self->utility_traceables);
|
g_value_set_object (value, self->utility_traceables);
|
||||||
break;
|
break;
|
||||||
@ -441,6 +484,11 @@ sysprof_callgraph_view_class_init (SysprofCallgraphViewClass *klass)
|
|||||||
G_TYPE_LIST_MODEL,
|
G_TYPE_LIST_MODEL,
|
||||||
(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
|
properties[PROP_UTILITY_SUMMARY] =
|
||||||
|
g_param_spec_object ("utility-summary", NULL, NULL,
|
||||||
|
G_TYPE_LIST_MODEL,
|
||||||
|
(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
properties[PROP_UTILITY_TRACEABLES] =
|
properties[PROP_UTILITY_TRACEABLES] =
|
||||||
g_param_spec_object ("utility-traceables", NULL, NULL,
|
g_param_spec_object ("utility-traceables", NULL, NULL,
|
||||||
G_TYPE_LIST_MODEL,
|
G_TYPE_LIST_MODEL,
|
||||||
|
|||||||
@ -82,6 +82,7 @@ sysprof_samples_section_class_init (SysprofSamplesSectionClass *klass)
|
|||||||
g_type_ensure (SYSPROF_TYPE_TRACEABLES_UTILITY);
|
g_type_ensure (SYSPROF_TYPE_TRACEABLES_UTILITY);
|
||||||
g_type_ensure (SYSPROF_TYPE_VALUE_AXIS);
|
g_type_ensure (SYSPROF_TYPE_VALUE_AXIS);
|
||||||
g_type_ensure (SYSPROF_TYPE_WEIGHTED_CALLGRAPH_VIEW);
|
g_type_ensure (SYSPROF_TYPE_WEIGHTED_CALLGRAPH_VIEW);
|
||||||
|
g_type_ensure (SYSPROF_TYPE_CATEGORY_SUMMARY);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
@ -146,14 +146,91 @@
|
|||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<property name="content">
|
<property name="content">
|
||||||
<object class="SysprofTraceablesUtility">
|
<object class="GtkBox">
|
||||||
<binding name="session">
|
<property name="orientation">vertical</property>
|
||||||
<lookup name="session">SysprofSamplesSection</lookup>
|
<child>
|
||||||
|
<object class="SysprofTraceablesUtility">
|
||||||
|
<property name="vexpand">true</property>
|
||||||
|
<binding name="session">
|
||||||
|
<lookup name="session">SysprofSamplesSection</lookup>
|
||||||
|
</binding>
|
||||||
|
<binding name="traceables">
|
||||||
|
<lookup name="utility-traceables">callgraph_view</lookup>
|
||||||
|
</binding>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkSeparator"/>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkScrolledWindow">
|
||||||
|
<property name="propagate-natural-width">true</property>
|
||||||
|
<property name="propagate-natural-height">true</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkListView">
|
||||||
|
<property name="model">
|
||||||
|
<object class="GtkNoSelection">
|
||||||
|
<binding name="model">
|
||||||
|
<lookup name="utility-summary">callgraph_view</lookup>
|
||||||
|
</binding>
|
||||||
|
</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="GtkBox">
|
||||||
|
<property name="margin-top">1</property>
|
||||||
|
<property name="margin-bottom">1</property>
|
||||||
|
<property name="margin-start">6</property>
|
||||||
|
<property name="margin-end">6</property>
|
||||||
|
<property name="spacing">6</property>
|
||||||
|
<child>
|
||||||
|
<object class="SysprofCategoryIcon">
|
||||||
|
<property name="width-request">16</property>
|
||||||
|
<property name="height-request">16</property>
|
||||||
|
<binding name="category">
|
||||||
|
<lookup name="category" type="SysprofCategorySummary">
|
||||||
|
<lookup name="item">GtkListItem</lookup>
|
||||||
|
</lookup>
|
||||||
</binding>
|
</binding>
|
||||||
<binding name="traceables">
|
</object>
|
||||||
<lookup name="utility-traceables">callgraph_view</lookup>
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="xalign">0</property>
|
||||||
|
<property name="hexpand">true</property>
|
||||||
|
<binding name="label">
|
||||||
|
<lookup name="category-name" type="SysprofCategorySummary">
|
||||||
|
<lookup name="item">GtkListItem</lookup>
|
||||||
|
</lookup>
|
||||||
</binding>
|
</binding>
|
||||||
</object>
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="SysprofProgressCell">
|
||||||
|
<binding name="fraction">
|
||||||
|
<lookup name="fraction" type="SysprofCategorySummary">
|
||||||
|
<lookup name="item">GtkListItem</lookup>
|
||||||
|
</lookup>
|
||||||
|
</binding>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</property>
|
||||||
|
</template>
|
||||||
|
</interface>
|
||||||
|
]]></property>
|
||||||
|
</object>
|
||||||
|
</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
</property>
|
</property>
|
||||||
</object>
|
</object>
|
||||||
</property>
|
</property>
|
||||||
|
|||||||
Reference in New Issue
Block a user