[sysprof] libsysprof: only add process cmdline info once
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sysprof] libsysprof: only add process cmdline info once
- Date: Tue, 18 Feb 2020 21:46:06 +0000 (UTC)
commit 9f43bf28130978647e82836f4db568a07071f453
Author: Christian Hergert <chergert redhat com>
Date: Tue Feb 18 13:45:15 2020 -0800
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.
src/libsysprof/sysprof-memprof-profile.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/src/libsysprof/sysprof-memprof-profile.c b/src/libsysprof/sysprof-memprof-profile.c
index 2dfe962..0513379 100644
--- a/src/libsysprof/sysprof-memprof-profile.c
+++ b/src/libsysprof/sysprof-memprof-profile.c
@@ -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;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]