sysprof: add toggles to categorize frames

This commit is contained in:
Christian Hergert
2023-07-20 12:30:11 -07:00
parent ae7201c9ff
commit ecdcfb83d0
8 changed files with 78 additions and 0 deletions

View File

@ -51,6 +51,7 @@ struct _SysprofCallgraphView
guint reload_source; guint reload_source;
guint bottom_up : 1; guint bottom_up : 1;
guint categorize_frames : 1;
guint include_threads : 1; guint include_threads : 1;
guint hide_system_libraries : 1; guint hide_system_libraries : 1;
}; };

View File

@ -32,6 +32,7 @@
enum { enum {
PROP_0, PROP_0,
PROP_BOTTOM_UP, PROP_BOTTOM_UP,
PROP_CATEGORIZE_FRAMES,
PROP_CALLGRAPH, PROP_CALLGRAPH,
PROP_DOCUMENT, PROP_DOCUMENT,
PROP_HIDE_SYSTEM_LIBRARIES, PROP_HIDE_SYSTEM_LIBRARIES,
@ -323,6 +324,10 @@ sysprof_callgraph_view_get_property (GObject *object,
g_value_set_boolean (value, sysprof_callgraph_view_get_bottom_up (self)); g_value_set_boolean (value, sysprof_callgraph_view_get_bottom_up (self));
break; break;
case PROP_CATEGORIZE_FRAMES:
g_value_set_boolean (value, sysprof_callgraph_view_get_categorize_frames (self));
break;
case PROP_CALLGRAPH: case PROP_CALLGRAPH:
g_value_set_object (value, sysprof_callgraph_view_get_callgraph (self)); g_value_set_object (value, sysprof_callgraph_view_get_callgraph (self));
break; break;
@ -366,6 +371,10 @@ sysprof_callgraph_view_set_property (GObject *object,
sysprof_callgraph_view_set_bottom_up (self, g_value_get_boolean (value)); sysprof_callgraph_view_set_bottom_up (self, g_value_get_boolean (value));
break; break;
case PROP_CATEGORIZE_FRAMES:
sysprof_callgraph_view_set_categorize_frames (self, g_value_get_boolean (value));
break;
case PROP_DOCUMENT: case PROP_DOCUMENT:
sysprof_callgraph_view_set_document (self, g_value_get_object (value)); sysprof_callgraph_view_set_document (self, g_value_get_object (value));
break; break;
@ -402,6 +411,11 @@ sysprof_callgraph_view_class_init (SysprofCallgraphViewClass *klass)
FALSE, FALSE,
(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
properties[PROP_CATEGORIZE_FRAMES] =
g_param_spec_boolean ("categorize-frames", NULL, NULL,
TRUE,
(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
properties[PROP_CALLGRAPH] = properties[PROP_CALLGRAPH] =
g_param_spec_object ("callgraph", NULL, NULL, g_param_spec_object ("callgraph", NULL, NULL,
SYSPROF_TYPE_CALLGRAPH, SYSPROF_TYPE_CALLGRAPH,
@ -460,6 +474,8 @@ sysprof_callgraph_view_class_init (SysprofCallgraphViewClass *klass)
static void static void
sysprof_callgraph_view_init (SysprofCallgraphView *self) sysprof_callgraph_view_init (SysprofCallgraphView *self)
{ {
self->categorize_frames = TRUE;
self->traceables_signals = g_signal_group_new (G_TYPE_LIST_MODEL); self->traceables_signals = g_signal_group_new (G_TYPE_LIST_MODEL);
g_signal_connect_object (self->traceables_signals, g_signal_connect_object (self->traceables_signals,
"bind", "bind",
@ -583,6 +599,9 @@ sysprof_callgraph_view_reload (SysprofCallgraphView *self)
if (self->bottom_up) if (self->bottom_up)
flags |= SYSPROF_CALLGRAPH_FLAGS_BOTTOM_UP; flags |= SYSPROF_CALLGRAPH_FLAGS_BOTTOM_UP;
if (self->categorize_frames)
flags |= SYSPROF_CALLGRAPH_FLAGS_CATEGORIZE_FRAMES;
sysprof_document_callgraph_async (self->document, sysprof_document_callgraph_async (self->document,
flags, flags,
self->traceables, self->traceables,
@ -741,6 +760,30 @@ sysprof_callgraph_view_set_bottom_up (SysprofCallgraphView *self,
} }
} }
gboolean
sysprof_callgraph_view_get_categorize_frames (SysprofCallgraphView *self)
{
g_return_val_if_fail (SYSPROF_IS_CALLGRAPH_VIEW (self), FALSE);
return self->categorize_frames;
}
void
sysprof_callgraph_view_set_categorize_frames (SysprofCallgraphView *self,
gboolean categorize_frames)
{
g_return_if_fail (SYSPROF_IS_CALLGRAPH_VIEW (self));
categorize_frames = !!categorize_frames;
if (self->categorize_frames != categorize_frames)
{
self->categorize_frames = categorize_frames;
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_CATEGORIZE_FRAMES]);
sysprof_callgraph_view_queue_reload (self);
}
}
gboolean gboolean
sysprof_callgraph_view_get_hide_system_libraries (SysprofCallgraphView *self) sysprof_callgraph_view_get_hide_system_libraries (SysprofCallgraphView *self)
{ {

View File

@ -46,6 +46,9 @@ void sysprof_callgraph_view_set_traceables (SysprofCallg
gboolean sysprof_callgraph_view_get_bottom_up (SysprofCallgraphView *self); gboolean sysprof_callgraph_view_get_bottom_up (SysprofCallgraphView *self);
void sysprof_callgraph_view_set_bottom_up (SysprofCallgraphView *self, void sysprof_callgraph_view_set_bottom_up (SysprofCallgraphView *self,
gboolean bottom_up); gboolean bottom_up);
gboolean sysprof_callgraph_view_get_categorize_frames (SysprofCallgraphView *self);
void sysprof_callgraph_view_set_categorize_frames (SysprofCallgraphView *self,
gboolean categorize_frames);
gboolean sysprof_callgraph_view_get_include_threads (SysprofCallgraphView *self); gboolean sysprof_callgraph_view_get_include_threads (SysprofCallgraphView *self);
void sysprof_callgraph_view_set_include_threads (SysprofCallgraphView *self, void sysprof_callgraph_view_set_include_threads (SysprofCallgraphView *self,
gboolean include_threads); gboolean include_threads);

View File

@ -234,6 +234,10 @@
</section> </section>
<section> <section>
<attribute name="label" translatable="yes">Options</attribute> <attribute name="label" translatable="yes">Options</attribute>
<item>
<attribute name="label" translatable="yes">Categorize Frames</attribute>
<attribute name="action">win.callgraph.categorize-frames</attribute>
</item>
<item> <item>
<attribute name="label" translatable="yes">Hide System Libraries</attribute> <attribute name="label" translatable="yes">Hide System Libraries</attribute>
<attribute name="action">win.callgraph.hide-system-libraries</attribute> <attribute name="action">win.callgraph.hide-system-libraries</attribute>

View File

@ -92,6 +92,11 @@
<lookup name="session">SysprofMemorySection</lookup> <lookup name="session">SysprofMemorySection</lookup>
</lookup> </lookup>
</binding> </binding>
<binding name="categorize-frames">
<lookup name="categorize-frames" type="SysprofSession">
<lookup name="session">SysprofMemorySection</lookup>
</lookup>
</binding>
<binding name="document"> <binding name="document">
<lookup name="document" type="SysprofSession"> <lookup name="document" type="SysprofSession">
<lookup name="session">SysprofMemorySection</lookup> <lookup name="session">SysprofMemorySection</lookup>

View File

@ -92,6 +92,11 @@
<lookup name="session">SysprofSamplesSection</lookup> <lookup name="session">SysprofSamplesSection</lookup>
</lookup> </lookup>
</binding> </binding>
<binding name="categorize-frames">
<lookup name="categorize-frames" type="SysprofSession">
<lookup name="session">SysprofSamplesSection</lookup>
</lookup>
</binding>
<binding name="document"> <binding name="document">
<lookup name="document" type="SysprofSession"> <lookup name="document" type="SysprofSession">
<lookup name="session">SysprofSamplesSection</lookup> <lookup name="session">SysprofSamplesSection</lookup>

View File

@ -40,6 +40,7 @@ struct _SysprofSession
SysprofTimeSpan visible_time; SysprofTimeSpan visible_time;
guint bottom_up : 1; guint bottom_up : 1;
guint categorize_frames : 1;
guint include_threads : 1; guint include_threads : 1;
guint hide_system_libraries : 1; guint hide_system_libraries : 1;
}; };
@ -52,6 +53,7 @@ enum {
PROP_FILTER, PROP_FILTER,
PROP_HIDE_SYSTEM_LIBRARIES, PROP_HIDE_SYSTEM_LIBRARIES,
PROP_INCLUDE_THREADS, PROP_INCLUDE_THREADS,
PROP_CATEGORIZE_FRAMES,
PROP_SELECTED_TIME, PROP_SELECTED_TIME,
PROP_SELECTED_TIME_AXIS, PROP_SELECTED_TIME_AXIS,
PROP_VISIBLE_TIME, PROP_VISIBLE_TIME,
@ -124,6 +126,10 @@ sysprof_session_get_property (GObject *object,
g_value_set_boolean (value, self->bottom_up); g_value_set_boolean (value, self->bottom_up);
break; break;
case PROP_CATEGORIZE_FRAMES:
g_value_set_boolean (value, self->categorize_frames);
break;
case PROP_DOCUMENT: case PROP_DOCUMENT:
g_value_set_object (value, sysprof_session_get_document (self)); g_value_set_object (value, sysprof_session_get_document (self));
break; break;
@ -179,6 +185,10 @@ sysprof_session_set_property (GObject *object,
self->bottom_up = g_value_get_boolean (value); self->bottom_up = g_value_get_boolean (value);
break; break;
case PROP_CATEGORIZE_FRAMES:
self->categorize_frames = g_value_get_boolean (value);
break;
case PROP_DOCUMENT: case PROP_DOCUMENT:
sysprof_session_set_document (self, g_value_get_object (value)); sysprof_session_set_document (self, g_value_get_object (value));
break; break;
@ -210,6 +220,11 @@ sysprof_session_class_init (SysprofSessionClass *klass)
FALSE, FALSE,
(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
properties [PROP_CATEGORIZE_FRAMES] =
g_param_spec_boolean ("categorize-frames", NULL, NULL,
FALSE,
(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
properties [PROP_DOCUMENT] = properties [PROP_DOCUMENT] =
g_param_spec_object ("document", NULL, NULL, g_param_spec_object ("document", NULL, NULL,
SYSPROF_TYPE_DOCUMENT, SYSPROF_TYPE_DOCUMENT,
@ -264,6 +279,7 @@ sysprof_session_init (SysprofSession *self)
self->filter = gtk_every_filter_new (); self->filter = gtk_every_filter_new ();
self->selected_time_axis = sysprof_value_axis_new (0, 0); self->selected_time_axis = sysprof_value_axis_new (0, 0);
self->visible_time_axis = sysprof_value_axis_new (0, 0); self->visible_time_axis = sysprof_value_axis_new (0, 0);
self->categorize_frames = TRUE;
} }
SysprofSession * SysprofSession *

View File

@ -125,6 +125,7 @@ sysprof_window_set_document (SysprofWindow *self,
{ {
static const char *callgraph_actions[] = { static const char *callgraph_actions[] = {
"bottom-up", "bottom-up",
"categorize-frames",
"hide-system-libraries", "hide-system-libraries",
"include-threads", "include-threads",
}; };