mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-12 16:10:54 +00:00
libsysprof: ensure descendants view is categorized
This commit is contained in:
@ -24,8 +24,6 @@
|
|||||||
#include "sysprof-categories-private.h"
|
#include "sysprof-categories-private.h"
|
||||||
#include "sysprof-symbol-private.h"
|
#include "sysprof-symbol-private.h"
|
||||||
|
|
||||||
static SysprofCategories *categories;
|
|
||||||
|
|
||||||
SysprofCallgraphCategory
|
SysprofCallgraphCategory
|
||||||
_sysprof_callgraph_node_categorize (SysprofCallgraphNode *node)
|
_sysprof_callgraph_node_categorize (SysprofCallgraphNode *node)
|
||||||
{
|
{
|
||||||
@ -47,10 +45,7 @@ _sysprof_callgraph_node_categorize (SysprofCallgraphNode *node)
|
|||||||
symbol->binary_nick == NULL)
|
symbol->binary_nick == NULL)
|
||||||
return SYSPROF_CALLGRAPH_CATEGORY_UNCATEGORIZED;
|
return SYSPROF_CALLGRAPH_CATEGORY_UNCATEGORIZED;
|
||||||
|
|
||||||
if G_UNLIKELY (categories == NULL)
|
category = sysprof_categories_lookup (NULL, symbol->binary_nick, symbol->name);
|
||||||
categories = sysprof_categories_new ();
|
|
||||||
|
|
||||||
category = sysprof_categories_lookup (categories, symbol->binary_nick, symbol->name);
|
|
||||||
|
|
||||||
if (category == 0)
|
if (category == 0)
|
||||||
return SYSPROF_CALLGRAPH_CATEGORY_UNCATEGORIZED;
|
return SYSPROF_CALLGRAPH_CATEGORY_UNCATEGORIZED;
|
||||||
|
|||||||
@ -87,5 +87,7 @@ gpointer _sysprof_callgraph_get_symbol_augment (SysprofCallgrap
|
|||||||
void _sysprof_callgraph_node_free (SysprofCallgraphNode *self,
|
void _sysprof_callgraph_node_free (SysprofCallgraphNode *self,
|
||||||
gboolean free_self);
|
gboolean free_self);
|
||||||
SysprofCallgraphCategory _sysprof_callgraph_node_categorize (SysprofCallgraphNode *node);
|
SysprofCallgraphCategory _sysprof_callgraph_node_categorize (SysprofCallgraphNode *node);
|
||||||
|
void _sysprof_callgraph_categorize (SysprofCallgraph *self,
|
||||||
|
SysprofCallgraphNode *node);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|||||||
@ -283,15 +283,15 @@ reverse_symbols (SysprofSymbol **symbols,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
sysprof_callgraph_categorize (SysprofCallgraph *self,
|
_sysprof_callgraph_categorize (SysprofCallgraph *self,
|
||||||
SysprofCallgraphNode *node)
|
SysprofCallgraphNode *node)
|
||||||
{
|
{
|
||||||
if (node->category)
|
if (node->category)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (node->parent && node->parent->category == 0)
|
if (node->parent && node->parent->category == 0)
|
||||||
sysprof_callgraph_categorize (self, node->parent);
|
_sysprof_callgraph_categorize (self, node->parent);
|
||||||
|
|
||||||
switch (node->summary->symbol->kind)
|
switch (node->summary->symbol->kind)
|
||||||
{
|
{
|
||||||
@ -437,7 +437,7 @@ sysprof_callgraph_add_traceable (SysprofCallgraph *self,
|
|||||||
self->augment_func_data);
|
self->augment_func_data);
|
||||||
|
|
||||||
if ((self->flags & SYSPROF_CALLGRAPH_FLAGS_CATEGORIZE_FRAMES) != 0)
|
if ((self->flags & SYSPROF_CALLGRAPH_FLAGS_CATEGORIZE_FRAMES) != 0)
|
||||||
sysprof_callgraph_categorize (self, node);
|
_sysprof_callgraph_categorize (self, node);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
@ -26,6 +26,7 @@ G_BEGIN_DECLS
|
|||||||
|
|
||||||
typedef struct _SysprofCategories SysprofCategories;
|
typedef struct _SysprofCategories SysprofCategories;
|
||||||
|
|
||||||
|
SysprofCategories *sysprof_categories_get_default (void) G_GNUC_CONST;
|
||||||
SysprofCategories *sysprof_categories_new (void);
|
SysprofCategories *sysprof_categories_new (void);
|
||||||
void sysprof_categories_free (SysprofCategories *categories);
|
void sysprof_categories_free (SysprofCategories *categories);
|
||||||
SysprofCallgraphCategory sysprof_categories_lookup (SysprofCategories *categories,
|
SysprofCallgraphCategory sysprof_categories_lookup (SysprofCategories *categories,
|
||||||
|
|||||||
@ -248,6 +248,9 @@ sysprof_categories_lookup (SysprofCategories *categories,
|
|||||||
{
|
{
|
||||||
GArray *rules;
|
GArray *rules;
|
||||||
|
|
||||||
|
if (categories == NULL)
|
||||||
|
categories = sysprof_categories_get_default ();
|
||||||
|
|
||||||
if (binary_nick == NULL || symbol == NULL)
|
if (binary_nick == NULL || symbol == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -277,3 +280,14 @@ sysprof_categories_lookup (SysprofCategories *categories,
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SysprofCategories *
|
||||||
|
sysprof_categories_get_default (void)
|
||||||
|
{
|
||||||
|
static SysprofCategories *instance;
|
||||||
|
|
||||||
|
if (instance == NULL)
|
||||||
|
instance = sysprof_categories_new ();
|
||||||
|
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|||||||
@ -216,6 +216,9 @@ sysprof_descendants_model_add_traceable (SysprofDescendantsModel *self,
|
|||||||
SYSPROF_DOCUMENT_FRAME (traceable),
|
SYSPROF_DOCUMENT_FRAME (traceable),
|
||||||
FALSE,
|
FALSE,
|
||||||
self->callgraph->augment_func_data);
|
self->callgraph->augment_func_data);
|
||||||
|
|
||||||
|
if ((self->callgraph->flags & SYSPROF_CALLGRAPH_FLAGS_CATEGORIZE_FRAMES) != 0)
|
||||||
|
_sysprof_callgraph_categorize (self->callgraph, node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user