mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
libsysprof-analyze: make summary augmentation optional
That way the descendant graphs can generate the self values but ignore the summary augmentation (as that would mess up the generated values). This fixes it so that showing the descendants tree keeps proper Total and Self values.
This commit is contained in:
@ -329,6 +329,7 @@ sysprof_callgraph_add_traceable (SysprofCallgraph *self,
|
||||
self->augment_func (self,
|
||||
node,
|
||||
SYSPROF_DOCUMENT_FRAME (traceable),
|
||||
TRUE,
|
||||
self->augment_func_data);
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -91,6 +91,7 @@ static void
|
||||
augment_cb (SysprofCallgraph *callgraph,
|
||||
SysprofCallgraphNode *node,
|
||||
SysprofDocumentFrame *frame,
|
||||
gboolean summarize,
|
||||
gpointer user_data)
|
||||
{
|
||||
Augment *aug;
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user