mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
libsysprof: only add process cmdline info once
We might get this information from multiple sources (such as Linux's perf or the proc data source). So only add this information once to avoid having additional data we don't care about. This also helps ensure we get a proper tree for the callgraph without splitting things between updated cmdline information.
This commit is contained in:
@ -221,11 +221,14 @@ cursor_foreach_cb (const SysprofCaptureFrame *frame,
|
||||
if G_UNLIKELY (frame->type == SYSPROF_CAPTURE_FRAME_PROCESS)
|
||||
{
|
||||
const SysprofCaptureProcess *pr = (const SysprofCaptureProcess *)frame;
|
||||
g_autofree gchar *cmdline = g_strdup_printf ("[%s]", pr->cmdline);
|
||||
|
||||
g_hash_table_insert (g->cmdlines,
|
||||
GINT_TO_POINTER (frame->pid),
|
||||
(gchar *)g_string_chunk_insert_const (g->symbols, cmdline));
|
||||
if (!g_hash_table_contains (g->cmdlines, GINT_TO_POINTER (frame->pid)))
|
||||
{
|
||||
g_autofree gchar *cmdline = g_strdup_printf ("[%s]", pr->cmdline);
|
||||
g_hash_table_insert (g->cmdlines,
|
||||
GINT_TO_POINTER (frame->pid),
|
||||
(gchar *)g_string_chunk_insert_const (g->symbols, cmdline));
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user