mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
libsysprof: sniff various forms of kernel process names
This is by no means perfect, but it gets the kernel tasks running on my machine out of the profiles. We will no doubt need to add more in the future, or find a way to record a flag for that in the capture format.
This commit is contained in:
@ -51,6 +51,9 @@ sysprof_process_info_new (SysprofMountNamespace *mount_namespace,
|
||||
0, 0,
|
||||
SYSPROF_SYMBOL_KIND_PROCESS);
|
||||
|
||||
if (pid == 0)
|
||||
self->fallback_symbol->is_kernel_process = TRUE;
|
||||
|
||||
if (pid > 0)
|
||||
egg_bitset_add (self->thread_ids, pid);
|
||||
|
||||
|
||||
@ -41,6 +41,7 @@ struct _SysprofSymbol
|
||||
|
||||
guint kind : 3;
|
||||
guint is_fallback : 1;
|
||||
guint is_kernel_process : 1;
|
||||
};
|
||||
|
||||
SysprofSymbol *_sysprof_symbol_new (GRefString *name,
|
||||
|
||||
@ -151,6 +151,20 @@ sysprof_symbol_get_binary_path (SysprofSymbol *self)
|
||||
return self->binary_path;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
sniff_maybe_kernel_process (const char *str)
|
||||
{
|
||||
if (g_str_has_prefix (str, "kworker/") ||
|
||||
g_str_equal (str, "rcu_preempt") ||
|
||||
g_str_has_prefix (str, "migration/") ||
|
||||
g_str_has_prefix (str, "dmcrypt_write/") ||
|
||||
g_str_has_prefix (str, "hwrng") ||
|
||||
g_str_has_prefix (str, "ksoftirqd/"))
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
SysprofSymbol *
|
||||
_sysprof_symbol_new (GRefString *name,
|
||||
GRefString *binary_path,
|
||||
@ -176,6 +190,9 @@ _sysprof_symbol_new (GRefString *name,
|
||||
self->simple_hash = g_str_hash (name);
|
||||
self->kind = kind;
|
||||
|
||||
if (self->kind == SYSPROF_SYMBOL_KIND_PROCESS)
|
||||
self->is_kernel_process = sniff_maybe_kernel_process (name);
|
||||
|
||||
if (binary_nick != NULL)
|
||||
self->simple_hash ^= g_str_hash (binary_nick);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user