sysprof: allow ignoring process 0

The idle process is sort of a catch-all at times, and so if you remove it
that can make it easier to get more reasonble percentages from the rest
of the system.
This commit is contained in:
Christian Hergert
2023-08-04 13:18:39 -07:00
parent 6ac730629f
commit fea7a11698
7 changed files with 67 additions and 1 deletions

View File

@ -54,8 +54,9 @@ struct _SysprofCallgraphView
guint bottom_up : 1;
guint categorize_frames : 1;
guint include_threads : 1;
guint hide_system_libraries : 1;
guint ignore_process_0 : 1;
guint include_threads : 1;
};
struct _SysprofCallgraphViewClass

View File

@ -36,6 +36,7 @@ enum {
PROP_CALLGRAPH,
PROP_DOCUMENT,
PROP_HIDE_SYSTEM_LIBRARIES,
PROP_IGNORE_PROCESS_0,
PROP_INCLUDE_THREADS,
PROP_TRACEABLES,
PROP_UTILITY_SUMMARY,
@ -435,6 +436,10 @@ sysprof_callgraph_view_set_property (GObject *object,
sysprof_callgraph_view_set_hide_system_libraries (self, g_value_get_boolean (value));
break;
case PROP_IGNORE_PROCESS_0:
sysprof_callgraph_view_set_ignore_process_0 (self, g_value_get_boolean (value));
break;
case PROP_INCLUDE_THREADS:
sysprof_callgraph_view_set_include_threads (self, g_value_get_boolean (value));
break;
@ -488,6 +493,11 @@ sysprof_callgraph_view_class_init (SysprofCallgraphViewClass *klass)
FALSE,
(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
properties[PROP_IGNORE_PROCESS_0] =
g_param_spec_boolean ("ignore-process-0", NULL, NULL,
FALSE,
(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
properties[PROP_TRACEABLES] =
g_param_spec_object ("traceables", NULL, NULL,
G_TYPE_LIST_MODEL,
@ -653,6 +663,9 @@ sysprof_callgraph_view_reload (SysprofCallgraphView *self)
g_clear_handle_id (&self->reload_source, g_source_remove);
if (self->ignore_process_0)
flags |= SYSPROF_CALLGRAPH_FLAGS_IGNORE_PROCESS_0;
if (self->include_threads)
flags |= SYSPROF_CALLGRAPH_FLAGS_INCLUDE_THREADS;
@ -894,3 +907,27 @@ sysprof_callgraph_view_set_include_threads (SysprofCallgraphView *self,
sysprof_callgraph_view_queue_reload (self);
}
}
gboolean
sysprof_callgraph_view_get_ignore_process_0 (SysprofCallgraphView *self)
{
g_return_val_if_fail (SYSPROF_IS_CALLGRAPH_VIEW (self), FALSE);
return self->ignore_process_0;
}
void
sysprof_callgraph_view_set_ignore_process_0 (SysprofCallgraphView *self,
gboolean ignore_process_0)
{
g_return_if_fail (SYSPROF_IS_CALLGRAPH_VIEW (self));
ignore_process_0 = !!ignore_process_0;
if (self->ignore_process_0 != ignore_process_0)
{
self->ignore_process_0 = ignore_process_0;
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_IGNORE_PROCESS_0]);
sysprof_callgraph_view_queue_reload (self);
}
}

View File

@ -49,6 +49,9 @@ void sysprof_callgraph_view_set_bottom_up (SysprofCallg
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_ignore_process_0 (SysprofCallgraphView *self);
void sysprof_callgraph_view_set_ignore_process_0 (SysprofCallgraphView *self,
gboolean ignore_process_0);
gboolean sysprof_callgraph_view_get_include_threads (SysprofCallgraphView *self);
void sysprof_callgraph_view_set_include_threads (SysprofCallgraphView *self,
gboolean include_threads);

View File

@ -271,6 +271,10 @@
<attribute name="label" translatable="yes">Bottom Up</attribute>
<attribute name="action">win.callgraph.bottom-up</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Ignore Process 0</attribute>
<attribute name="action">win.callgraph.ignore-process-0</attribute>
</item>
</section>
</menu>
</interface>

View File

@ -97,6 +97,11 @@
<lookup name="session">SysprofSamplesSection</lookup>
</lookup>
</binding>
<binding name="ignore-process-0">
<lookup name="ignore-process-0" type="SysprofSession">
<lookup name="session">SysprofSamplesSection</lookup>
</lookup>
</binding>
<binding name="document">
<lookup name="document" type="SysprofSession">
<lookup name="session">SysprofSamplesSection</lookup>

View File

@ -41,6 +41,7 @@ struct _SysprofSession
guint bottom_up : 1;
guint categorize_frames : 1;
guint ignore_process_0 : 1;
guint include_threads : 1;
guint hide_system_libraries : 1;
};
@ -52,6 +53,7 @@ enum {
PROP_DOCUMENT_TIME,
PROP_FILTER,
PROP_HIDE_SYSTEM_LIBRARIES,
PROP_IGNORE_PROCESS_0,
PROP_INCLUDE_THREADS,
PROP_CATEGORIZE_FRAMES,
PROP_SELECTED_TIME,
@ -146,6 +148,10 @@ sysprof_session_get_property (GObject *object,
g_value_set_boolean (value, self->hide_system_libraries);
break;
case PROP_IGNORE_PROCESS_0:
g_value_set_boolean (value, self->ignore_process_0);
break;
case PROP_INCLUDE_THREADS:
g_value_set_boolean (value, self->include_threads);
break;
@ -197,6 +203,10 @@ sysprof_session_set_property (GObject *object,
self->hide_system_libraries = g_value_get_boolean (value);
break;
case PROP_IGNORE_PROCESS_0:
self->ignore_process_0 = g_value_get_boolean (value);
break;
case PROP_INCLUDE_THREADS:
self->include_threads = g_value_get_boolean (value);
break;
@ -245,6 +255,11 @@ sysprof_session_class_init (SysprofSessionClass *klass)
FALSE,
(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
properties [PROP_IGNORE_PROCESS_0] =
g_param_spec_boolean ("ignore-process-0", NULL, NULL,
FALSE,
(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
properties [PROP_INCLUDE_THREADS] =
g_param_spec_boolean ("include-threads", NULL, NULL,
FALSE,

View File

@ -132,6 +132,7 @@ sysprof_window_set_document (SysprofWindow *self,
"bottom-up",
"categorize-frames",
"hide-system-libraries",
"ignore-process-0",
"include-threads",
};