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