mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
libsysprof: add flag to ignore kernel processes
This commit is contained in:
@ -345,12 +345,12 @@ _sysprof_callgraph_categorize (SysprofCallgraph *self,
|
|||||||
static void
|
static void
|
||||||
sysprof_callgraph_add_traceable (SysprofCallgraph *self,
|
sysprof_callgraph_add_traceable (SysprofCallgraph *self,
|
||||||
SysprofDocumentTraceable *traceable,
|
SysprofDocumentTraceable *traceable,
|
||||||
guint list_model_index,
|
guint list_model_index)
|
||||||
gboolean merge_similar_processes)
|
|
||||||
{
|
{
|
||||||
SysprofAddressContext final_context;
|
SysprofAddressContext final_context;
|
||||||
SysprofCallgraphNode *node;
|
SysprofCallgraphNode *node;
|
||||||
SysprofSymbol **symbols;
|
SysprofSymbol **symbols;
|
||||||
|
SysprofSymbol *process_symbol;
|
||||||
guint stack_depth;
|
guint stack_depth;
|
||||||
guint n_symbols;
|
guint n_symbols;
|
||||||
int pid;
|
int pid;
|
||||||
@ -365,9 +365,15 @@ sysprof_callgraph_add_traceable (SysprofCallgraph *self,
|
|||||||
if (pid == 0 && (self->flags & SYSPROF_CALLGRAPH_FLAGS_IGNORE_PROCESS_0) != 0)
|
if (pid == 0 && (self->flags & SYSPROF_CALLGRAPH_FLAGS_IGNORE_PROCESS_0) != 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
tid = sysprof_document_traceable_get_thread_id (traceable);
|
/* Ignore kernel processes if requested */
|
||||||
stack_depth = sysprof_document_traceable_get_stack_depth (traceable);
|
process_symbol = _sysprof_document_process_symbol (self->document, pid, !!(self->flags & SYSPROF_CALLGRAPH_FLAGS_MERGE_SIMILAR_PROCESSES));
|
||||||
|
if (process_symbol->is_kernel_process && (self->flags & SYSPROF_CALLGRAPH_FLAGS_IGNORE_KERNEL_PROCESSES))
|
||||||
|
return;
|
||||||
|
|
||||||
|
tid = sysprof_document_traceable_get_thread_id (traceable);
|
||||||
|
|
||||||
|
/* Early ignore anything with empty or too large a stack */
|
||||||
|
stack_depth = sysprof_document_traceable_get_stack_depth (traceable);
|
||||||
if (stack_depth == 0 || stack_depth > MAX_STACK_DEPTH)
|
if (stack_depth == 0 || stack_depth > MAX_STACK_DEPTH)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -422,7 +428,7 @@ sysprof_callgraph_add_traceable (SysprofCallgraph *self,
|
|||||||
if ((self->flags & SYSPROF_CALLGRAPH_FLAGS_INCLUDE_THREADS) != 0)
|
if ((self->flags & SYSPROF_CALLGRAPH_FLAGS_INCLUDE_THREADS) != 0)
|
||||||
symbols[n_symbols++] = _sysprof_document_thread_symbol (self->document, pid, tid);
|
symbols[n_symbols++] = _sysprof_document_thread_symbol (self->document, pid, tid);
|
||||||
|
|
||||||
symbols[n_symbols++] = _sysprof_document_process_symbol (self->document, pid, merge_similar_processes);
|
symbols[n_symbols++] = process_symbol;
|
||||||
symbols[n_symbols++] = everything;
|
symbols[n_symbols++] = everything;
|
||||||
|
|
||||||
if (n_symbols > self->height)
|
if (n_symbols > self->height)
|
||||||
@ -521,7 +527,6 @@ sysprof_callgraph_new_worker (GTask *task,
|
|||||||
GCancellable *cancellable)
|
GCancellable *cancellable)
|
||||||
{
|
{
|
||||||
SysprofCallgraph *self = task_data;
|
SysprofCallgraph *self = task_data;
|
||||||
gboolean merge_similar_processes;
|
|
||||||
guint n_items;
|
guint n_items;
|
||||||
|
|
||||||
g_assert (G_IS_TASK (task));
|
g_assert (G_IS_TASK (task));
|
||||||
@ -531,8 +536,6 @@ sysprof_callgraph_new_worker (GTask *task,
|
|||||||
|
|
||||||
n_items = g_list_model_get_n_items (self->traceables);
|
n_items = g_list_model_get_n_items (self->traceables);
|
||||||
|
|
||||||
merge_similar_processes = (self->flags & SYSPROF_CALLGRAPH_FLAGS_MERGE_SIMILAR_PROCESSES) != 0;
|
|
||||||
|
|
||||||
for (guint i = 0; i < n_items; i++)
|
for (guint i = 0; i < n_items; i++)
|
||||||
{
|
{
|
||||||
g_autoptr(SysprofDocumentTraceable) traceable = g_list_model_get_item (self->traceables, i);
|
g_autoptr(SysprofDocumentTraceable) traceable = g_list_model_get_item (self->traceables, i);
|
||||||
@ -544,7 +547,7 @@ sysprof_callgraph_new_worker (GTask *task,
|
|||||||
if (traceable == NULL)
|
if (traceable == NULL)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
sysprof_callgraph_add_traceable (self, traceable, i, merge_similar_processes);
|
sysprof_callgraph_add_traceable (self, traceable, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Sort callgraph nodes alphabetically so that we can use them in the
|
/* Sort callgraph nodes alphabetically so that we can use them in the
|
||||||
|
|||||||
@ -101,6 +101,7 @@ typedef enum _SysprofCallgraphFlags
|
|||||||
SYSPROF_CALLGRAPH_FLAGS_IGNORE_PROCESS_0 = 1 << 5,
|
SYSPROF_CALLGRAPH_FLAGS_IGNORE_PROCESS_0 = 1 << 5,
|
||||||
SYSPROF_CALLGRAPH_FLAGS_LEFT_HEAVY = 1 << 6,
|
SYSPROF_CALLGRAPH_FLAGS_LEFT_HEAVY = 1 << 6,
|
||||||
SYSPROF_CALLGRAPH_FLAGS_MERGE_SIMILAR_PROCESSES = 1 << 7,
|
SYSPROF_CALLGRAPH_FLAGS_MERGE_SIMILAR_PROCESSES = 1 << 7,
|
||||||
|
SYSPROF_CALLGRAPH_FLAGS_IGNORE_KERNEL_PROCESSES = 1 << 8,
|
||||||
} SysprofCallgraphFlags;
|
} SysprofCallgraphFlags;
|
||||||
|
|
||||||
SYSPROF_AVAILABLE_IN_ALL
|
SYSPROF_AVAILABLE_IN_ALL
|
||||||
|
|||||||
Reference in New Issue
Block a user