sysprof: add ui to toggle ignoring kernel processes

This commit is contained in:
Christian Hergert
2023-08-28 14:57:58 -07:00
parent c4e96bb314
commit 7150db0045
8 changed files with 70 additions and 0 deletions

View File

@ -55,6 +55,7 @@ struct _SysprofCallgraphView
guint bottom_up : 1;
guint categorize_frames : 1;
guint hide_system_libraries : 1;
guint ignore_kernel_processes : 1;
guint ignore_process_0 : 1;
guint include_threads : 1;
guint left_heavy : 1;

View File

@ -36,6 +36,7 @@ enum {
PROP_CALLGRAPH,
PROP_DOCUMENT,
PROP_HIDE_SYSTEM_LIBRARIES,
PROP_IGNORE_KERNEL_PROCESSES,
PROP_IGNORE_PROCESS_0,
PROP_INCLUDE_THREADS,
PROP_LEFT_HEAVY,
@ -451,6 +452,10 @@ sysprof_callgraph_view_set_property (GObject *object,
sysprof_callgraph_view_set_ignore_process_0 (self, g_value_get_boolean (value));
break;
case PROP_IGNORE_KERNEL_PROCESSES:
sysprof_callgraph_view_set_ignore_kernel_processes (self, g_value_get_boolean (value));
break;
case PROP_INCLUDE_THREADS:
sysprof_callgraph_view_set_include_threads (self, g_value_get_boolean (value));
break;
@ -517,6 +522,11 @@ sysprof_callgraph_view_class_init (SysprofCallgraphViewClass *klass)
FALSE,
(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
properties[PROP_IGNORE_KERNEL_PROCESSES] =
g_param_spec_boolean ("ignore-kernel-processes", NULL, NULL,
FALSE,
(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
properties[PROP_LEFT_HEAVY] =
g_param_spec_boolean ("left-heavy", NULL, NULL,
FALSE,
@ -714,6 +724,9 @@ sysprof_callgraph_view_reload (SysprofCallgraphView *self)
if (self->merge_similar_processes)
flags |= SYSPROF_CALLGRAPH_FLAGS_MERGE_SIMILAR_PROCESSES;
if (self->ignore_kernel_processes)
flags |= SYSPROF_CALLGRAPH_FLAGS_IGNORE_KERNEL_PROCESSES;
sysprof_document_callgraph_async (self->document,
flags,
self->traceables,
@ -944,6 +957,30 @@ sysprof_callgraph_view_set_include_threads (SysprofCallgraphView *self,
}
}
gboolean
sysprof_callgraph_view_get_ignore_kernel_processes (SysprofCallgraphView *self)
{
g_return_val_if_fail (SYSPROF_IS_CALLGRAPH_VIEW (self), FALSE);
return self->ignore_kernel_processes;
}
void
sysprof_callgraph_view_set_ignore_kernel_processes (SysprofCallgraphView *self,
gboolean ignore_kernel_processes)
{
g_return_if_fail (SYSPROF_IS_CALLGRAPH_VIEW (self));
ignore_kernel_processes = !!ignore_kernel_processes;
if (self->ignore_kernel_processes != ignore_kernel_processes)
{
self->ignore_kernel_processes = ignore_kernel_processes;
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_IGNORE_KERNEL_PROCESSES]);
sysprof_callgraph_view_queue_reload (self);
}
}
gboolean
sysprof_callgraph_view_get_ignore_process_0 (SysprofCallgraphView *self)
{

View File

@ -52,6 +52,9 @@ void sysprof_callgraph_view_set_categorize_frames (SysprofCal
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_ignore_kernel_processes (SysprofCallgraphView *self);
void sysprof_callgraph_view_set_ignore_kernel_processes (SysprofCallgraphView *self,
gboolean ignore_kernel_processes);
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 Kernel Processes</attribute>
<attribute name="action">win.callgraph.ignore-kernel-processes</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Ignore Process 0</attribute>
<attribute name="action">win.callgraph.ignore-process-0</attribute>

View File

@ -109,6 +109,11 @@
<lookup name="session">SysprofSamplesSection</lookup>
</lookup>
</binding>
<binding name="ignore-kernel-processes">
<lookup name="ignore-kernel-processes" type="SysprofSession">
<lookup name="session">SysprofSamplesSection</lookup>
</lookup>
</binding>
<binding name="merge-similar-processes">
<lookup name="merge-similar-processes" type="SysprofSession">
<lookup name="session">SysprofSamplesSection</lookup>

View File

@ -43,6 +43,7 @@ struct _SysprofSession
guint categorize_frames : 1;
guint hide_system_libraries : 1;
guint ignore_process_0 : 1;
guint ignore_kernel_processes : 1;
guint include_threads : 1;
guint left_heavy : 1;
guint merge_similar_processes : 1;
@ -56,6 +57,7 @@ enum {
PROP_DOCUMENT_TIME,
PROP_FILTER,
PROP_HIDE_SYSTEM_LIBRARIES,
PROP_IGNORE_KERNEL_PROCESSES,
PROP_IGNORE_PROCESS_0,
PROP_INCLUDE_THREADS,
PROP_LEFT_HEAVY,
@ -156,6 +158,10 @@ sysprof_session_get_property (GObject *object,
g_value_set_boolean (value, self->ignore_process_0);
break;
case PROP_IGNORE_KERNEL_PROCESSES:
g_value_set_boolean (value, self->ignore_kernel_processes);
break;
case PROP_INCLUDE_THREADS:
g_value_set_boolean (value, self->include_threads);
break;
@ -219,6 +225,10 @@ sysprof_session_set_property (GObject *object,
self->ignore_process_0 = g_value_get_boolean (value);
break;
case PROP_IGNORE_KERNEL_PROCESSES:
self->ignore_kernel_processes = g_value_get_boolean (value);
break;
case PROP_INCLUDE_THREADS:
self->include_threads = g_value_get_boolean (value);
break;
@ -280,6 +290,11 @@ sysprof_session_class_init (SysprofSessionClass *klass)
FALSE,
(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
properties [PROP_IGNORE_KERNEL_PROCESSES] =
g_param_spec_boolean ("ignore-kernel-processes", 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

@ -222,6 +222,7 @@ sysprof_window_set_document (SysprofWindow *self,
"bottom-up",
"categorize-frames",
"hide-system-libraries",
"ignore-kernel-processes",
"ignore-process-0",
"include-threads",
"left-heavy",

View File

@ -377,6 +377,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 Kernel Processes</attribute>
<attribute name="action">win.callgraph.ignore-kernel-processes</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Ignore Process 0</attribute>
<attribute name="action">win.callgraph.ignore-process-0</attribute>