mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-10 07:00:53 +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,
|
self->augment_func (self,
|
||||||
node,
|
node,
|
||||||
SYSPROF_DOCUMENT_FRAME (traceable),
|
SYSPROF_DOCUMENT_FRAME (traceable),
|
||||||
|
TRUE,
|
||||||
self->augment_func_data);
|
self->augment_func_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -42,6 +42,7 @@ typedef struct _SysprofCallgraphNode SysprofCallgraphNode;
|
|||||||
* @callgraph: the callgraph being augmented
|
* @callgraph: the callgraph being augmented
|
||||||
* @node: the node within the callgraph
|
* @node: the node within the callgraph
|
||||||
* @frame: the frame used to generate this node
|
* @frame: the frame used to generate this node
|
||||||
|
* @summarize: if summaries should be generated
|
||||||
* @user_data: closure data for augmentation func
|
* @user_data: closure data for augmentation func
|
||||||
*
|
*
|
||||||
* This function is called for the bottom most node in a trace as it is added
|
* 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
|
* 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
|
* 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,
|
* 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,
|
typedef void (*SysprofAugmentationFunc) (SysprofCallgraph *callgraph,
|
||||||
SysprofCallgraphNode *node,
|
SysprofCallgraphNode *node,
|
||||||
SysprofDocumentFrame *frame,
|
SysprofDocumentFrame *frame,
|
||||||
|
gboolean summarize,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
|
||||||
SYSPROF_AVAILABLE_IN_ALL
|
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);
|
node = sysprof_descendants_model_add_trace (self, symbols, n_symbols);
|
||||||
|
|
||||||
/* TODO: This will fuck up summaries */
|
|
||||||
|
|
||||||
if (node && self->callgraph->augment_func)
|
if (node && self->callgraph->augment_func)
|
||||||
self->callgraph->augment_func (self->callgraph,
|
self->callgraph->augment_func (self->callgraph,
|
||||||
node,
|
node,
|
||||||
SYSPROF_DOCUMENT_FRAME (traceable),
|
SYSPROF_DOCUMENT_FRAME (traceable),
|
||||||
|
FALSE,
|
||||||
self->callgraph->augment_func_data);
|
self->callgraph->augment_func_data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -91,6 +91,7 @@ static void
|
|||||||
augment_cb (SysprofCallgraph *callgraph,
|
augment_cb (SysprofCallgraph *callgraph,
|
||||||
SysprofCallgraphNode *node,
|
SysprofCallgraphNode *node,
|
||||||
SysprofDocumentFrame *frame,
|
SysprofDocumentFrame *frame,
|
||||||
|
gboolean summarize,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
Augment *aug;
|
Augment *aug;
|
||||||
|
|||||||
@ -54,10 +54,7 @@ struct _SysprofCallgraphViewClass
|
|||||||
GtkWidgetClass parent_class;
|
GtkWidgetClass parent_class;
|
||||||
|
|
||||||
gsize augment_size;
|
gsize augment_size;
|
||||||
void (*augment_func) (SysprofCallgraph *callgraph,
|
SysprofAugmentationFunc augment_func;
|
||||||
SysprofCallgraphNode *node,
|
|
||||||
SysprofDocumentFrame *frame,
|
|
||||||
gpointer user_data);
|
|
||||||
|
|
||||||
void (*load) (SysprofCallgraphView *self,
|
void (*load) (SysprofCallgraphView *self,
|
||||||
SysprofCallgraph *callgraph);
|
SysprofCallgraph *callgraph);
|
||||||
|
|||||||
@ -61,6 +61,7 @@ static void
|
|||||||
augment_weight (SysprofCallgraph *callgraph,
|
augment_weight (SysprofCallgraph *callgraph,
|
||||||
SysprofCallgraphNode *node,
|
SysprofCallgraphNode *node,
|
||||||
SysprofDocumentFrame *frame,
|
SysprofDocumentFrame *frame,
|
||||||
|
gboolean summarize,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
AugmentWeight *cur;
|
AugmentWeight *cur;
|
||||||
@ -75,9 +76,12 @@ augment_weight (SysprofCallgraph *callgraph,
|
|||||||
cur->size += 1;
|
cur->size += 1;
|
||||||
cur->total += 1;
|
cur->total += 1;
|
||||||
|
|
||||||
sum = sysprof_callgraph_get_summary_augment (callgraph, node);
|
if (summarize)
|
||||||
sum->size += 1;
|
{
|
||||||
sum->total += 1;
|
sum = sysprof_callgraph_get_summary_augment (callgraph, node);
|
||||||
|
sum->size += 1;
|
||||||
|
sum->total += 1;
|
||||||
|
}
|
||||||
|
|
||||||
for (node = sysprof_callgraph_node_parent (node);
|
for (node = sysprof_callgraph_node_parent (node);
|
||||||
node != NULL;
|
node != NULL;
|
||||||
@ -86,8 +90,11 @@ augment_weight (SysprofCallgraph *callgraph,
|
|||||||
cur = sysprof_callgraph_get_augment (callgraph, node);
|
cur = sysprof_callgraph_get_augment (callgraph, node);
|
||||||
cur->total += 1;
|
cur->total += 1;
|
||||||
|
|
||||||
sum = sysprof_callgraph_get_summary_augment (callgraph, node);
|
if (summarize)
|
||||||
sum->total += 1;
|
{
|
||||||
|
sum = sysprof_callgraph_get_summary_augment (callgraph, node);
|
||||||
|
sum->total += 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user