diff --git a/src/libsysprof-analyze/sysprof-callgraph.c b/src/libsysprof-analyze/sysprof-callgraph.c index db46db92..caf0f08f 100644 --- a/src/libsysprof-analyze/sysprof-callgraph.c +++ b/src/libsysprof-analyze/sysprof-callgraph.c @@ -329,6 +329,7 @@ sysprof_callgraph_add_traceable (SysprofCallgraph *self, self->augment_func (self, node, SYSPROF_DOCUMENT_FRAME (traceable), + TRUE, self->augment_func_data); } diff --git a/src/libsysprof-analyze/sysprof-callgraph.h b/src/libsysprof-analyze/sysprof-callgraph.h index 5e5e0cb0..e5057687 100644 --- a/src/libsysprof-analyze/sysprof-callgraph.h +++ b/src/libsysprof-analyze/sysprof-callgraph.h @@ -42,6 +42,7 @@ typedef struct _SysprofCallgraphNode SysprofCallgraphNode; * @callgraph: the callgraph being augmented * @node: the node within the callgraph * @frame: the frame used to generate this node + * @summarize: if summaries should be generated * @user_data: closure data for augmentation func * * This function is called for the bottom most node in a trace as it is added @@ -50,11 +51,15 @@ typedef struct _SysprofCallgraphNode SysprofCallgraphNode; * The augmentation func should augment the node in whatever way it sees fit * and generally will want to walk up the node tree to the root to augment the * parents as it goes. Your augmentation function is not called for each node, - * only the last node. + * only the deepest node. + * + * If @summarize is %TRUE, then you should also generate summary augmentation + * using sysprof_callgraph_get_summary_augment() or similar. */ typedef void (*SysprofAugmentationFunc) (SysprofCallgraph *callgraph, SysprofCallgraphNode *node, SysprofDocumentFrame *frame, + gboolean summarize, gpointer user_data); SYSPROF_AVAILABLE_IN_ALL diff --git a/src/libsysprof-analyze/sysprof-descendants-model.c b/src/libsysprof-analyze/sysprof-descendants-model.c index ac99cdc3..025a2ed3 100644 --- a/src/libsysprof-analyze/sysprof-descendants-model.c +++ b/src/libsysprof-analyze/sysprof-descendants-model.c @@ -192,12 +192,11 @@ sysprof_descendants_model_add_traceable (SysprofDescendantsModel *self, node = sysprof_descendants_model_add_trace (self, symbols, n_symbols); - /* TODO: This will fuck up summaries */ - if (node && self->callgraph->augment_func) self->callgraph->augment_func (self->callgraph, node, SYSPROF_DOCUMENT_FRAME (traceable), + FALSE, self->callgraph->augment_func_data); } } diff --git a/src/libsysprof-analyze/tests/test-callgraph.c b/src/libsysprof-analyze/tests/test-callgraph.c index 03479b2c..49ca0bea 100644 --- a/src/libsysprof-analyze/tests/test-callgraph.c +++ b/src/libsysprof-analyze/tests/test-callgraph.c @@ -91,6 +91,7 @@ static void augment_cb (SysprofCallgraph *callgraph, SysprofCallgraphNode *node, SysprofDocumentFrame *frame, + gboolean summarize, gpointer user_data) { Augment *aug; diff --git a/src/libsysprof-gtk/sysprof-callgraph-view-private.h b/src/libsysprof-gtk/sysprof-callgraph-view-private.h index 934cea32..f574bd74 100644 --- a/src/libsysprof-gtk/sysprof-callgraph-view-private.h +++ b/src/libsysprof-gtk/sysprof-callgraph-view-private.h @@ -54,10 +54,7 @@ struct _SysprofCallgraphViewClass GtkWidgetClass parent_class; gsize augment_size; - void (*augment_func) (SysprofCallgraph *callgraph, - SysprofCallgraphNode *node, - SysprofDocumentFrame *frame, - gpointer user_data); + SysprofAugmentationFunc augment_func; void (*load) (SysprofCallgraphView *self, SysprofCallgraph *callgraph); diff --git a/src/libsysprof-gtk/sysprof-weighted-callgraph-view.c b/src/libsysprof-gtk/sysprof-weighted-callgraph-view.c index e1cfa7e6..f1ac08da 100644 --- a/src/libsysprof-gtk/sysprof-weighted-callgraph-view.c +++ b/src/libsysprof-gtk/sysprof-weighted-callgraph-view.c @@ -61,6 +61,7 @@ static void augment_weight (SysprofCallgraph *callgraph, SysprofCallgraphNode *node, SysprofDocumentFrame *frame, + gboolean summarize, gpointer user_data) { AugmentWeight *cur; @@ -75,9 +76,12 @@ augment_weight (SysprofCallgraph *callgraph, cur->size += 1; cur->total += 1; - sum = sysprof_callgraph_get_summary_augment (callgraph, node); - sum->size += 1; - sum->total += 1; + if (summarize) + { + sum = sysprof_callgraph_get_summary_augment (callgraph, node); + sum->size += 1; + sum->total += 1; + } for (node = sysprof_callgraph_node_parent (node); node != NULL; @@ -86,8 +90,11 @@ augment_weight (SysprofCallgraph *callgraph, cur = sysprof_callgraph_get_augment (callgraph, node); cur->total += 1; - sum = sysprof_callgraph_get_summary_augment (callgraph, node); - sum->total += 1; + if (summarize) + { + sum = sysprof_callgraph_get_summary_augment (callgraph, node); + sum->total += 1; + } } }