From 0f70dd1d68ed7621fc24675363687af371ae969f Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Thu, 20 Jul 2023 17:02:34 -0700 Subject: [PATCH] libsysprof: keep count in callgraph node I don't want this to overlap with augmentation data, or be augmentation data specific, so just keep our own private copy of this data in the node to do the sort of things we want with it (such as summaries). --- src/libsysprof/sysprof-callgraph-private.h | 5 +++-- src/libsysprof/sysprof-callgraph.c | 5 +++-- src/libsysprof/sysprof-descendants-model.c | 1 + 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/libsysprof/sysprof-callgraph-private.h b/src/libsysprof/sysprof-callgraph-private.h index 217dd6c2..88cd00f6 100644 --- a/src/libsysprof/sysprof-callgraph-private.h +++ b/src/libsysprof/sysprof-callgraph-private.h @@ -47,8 +47,9 @@ struct _SysprofCallgraphNode SysprofCallgraphNode *children; SysprofCallgraphSummary *summary; gpointer augment[2]; - SysprofCallgraphCategory category : 7; - SysprofCallgraphCategory is_toplevel : 7; + guint category : 7; + guint is_toplevel : 1; + guint count : 24; }; struct _SysprofCallgraph diff --git a/src/libsysprof/sysprof-callgraph.c b/src/libsysprof/sysprof-callgraph.c index ec2bca0f..1f26d4e2 100644 --- a/src/libsysprof/sysprof-callgraph.c +++ b/src/libsysprof/sysprof-callgraph.c @@ -191,8 +191,6 @@ sysprof_callgraph_populate_callers (SysprofCallgraph *self, g_assert (SYSPROF_IS_CALLGRAPH (self)); g_assert (node != NULL); - node->is_toplevel = TRUE; - for (const SysprofCallgraphNode *iter = node; iter != NULL; iter = iter->parent) @@ -431,6 +429,9 @@ sysprof_callgraph_add_traceable (SysprofCallgraph *self, list_model_index, !!(self->flags & SYSPROF_CALLGRAPH_FLAGS_HIDE_SYSTEM_LIBRARIES)); + node->is_toplevel = TRUE; + node->count++; + if (node && self->augment_func) self->augment_func (self, node, diff --git a/src/libsysprof/sysprof-descendants-model.c b/src/libsysprof/sysprof-descendants-model.c index 3507c2e3..c3b37654 100644 --- a/src/libsysprof/sysprof-descendants-model.c +++ b/src/libsysprof/sysprof-descendants-model.c @@ -211,6 +211,7 @@ sysprof_descendants_model_add_traceable (SysprofDescendantsModel *self, node = sysprof_descendants_model_add_trace (self, symbols, n_symbols); node->is_toplevel = TRUE; + node->count++; if (node && self->callgraph->augment_func) self->callgraph->augment_func (self->callgraph,