libsysprof: add API to ignore the idle process (pid 0)

This commit is contained in:
Christian Hergert
2023-08-04 12:39:12 -07:00
parent 0ae8765c0e
commit 6ac730629f
2 changed files with 6 additions and 0 deletions

View File

@ -356,6 +356,11 @@ sysprof_callgraph_add_traceable (SysprofCallgraph *self,
g_assert (SYSPROF_IS_DOCUMENT_TRACEABLE (traceable));
pid = sysprof_document_frame_get_pid (SYSPROF_DOCUMENT_FRAME (traceable));
/* Ignore "Process 0" (the Idle process) if requested */
if (pid == 0 && (self->flags & SYSPROF_CALLGRAPH_FLAGS_IGNORE_PROCESS_0) != 0)
return;
tid = sysprof_document_traceable_get_thread_id (traceable);
stack_depth = sysprof_document_traceable_get_stack_depth (traceable);

View File

@ -97,6 +97,7 @@ typedef enum _SysprofCallgraphFlags
SYSPROF_CALLGRAPH_FLAGS_HIDE_SYSTEM_LIBRARIES = 1 << 2,
SYSPROF_CALLGRAPH_FLAGS_BOTTOM_UP = 1 << 3,
SYSPROF_CALLGRAPH_FLAGS_CATEGORIZE_FRAMES = 1 << 4,
SYSPROF_CALLGRAPH_FLAGS_IGNORE_PROCESS_0 = 1 << 5,
} SysprofCallgraphFlags;
SYSPROF_AVAILABLE_IN_ALL