mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-10 15:10:53 +00:00
libsysprof-analyze: allow two pointers for augmentation
This affords us the ability to shove memory statistics in the inline augmentation area for memprof data.
This commit is contained in:
@ -34,7 +34,7 @@ typedef struct _SysprofCallgraphSummary
|
|||||||
SysprofSymbol *symbol;
|
SysprofSymbol *symbol;
|
||||||
EggBitset *traceables;
|
EggBitset *traceables;
|
||||||
GPtrArray *callers;
|
GPtrArray *callers;
|
||||||
gpointer augment;
|
gpointer augment[2];
|
||||||
} SysprofCallgraphSummary;
|
} SysprofCallgraphSummary;
|
||||||
|
|
||||||
struct _SysprofCallgraphNode
|
struct _SysprofCallgraphNode
|
||||||
@ -44,7 +44,7 @@ struct _SysprofCallgraphNode
|
|||||||
SysprofCallgraphNode *next;
|
SysprofCallgraphNode *next;
|
||||||
SysprofCallgraphNode *children;
|
SysprofCallgraphNode *children;
|
||||||
SysprofCallgraphSummary *summary;
|
SysprofCallgraphSummary *summary;
|
||||||
gpointer augment;
|
gpointer augment[2];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _SysprofCallgraph
|
struct _SysprofCallgraph
|
||||||
|
|||||||
@ -31,7 +31,8 @@
|
|||||||
|
|
||||||
#include "eggbitset.h"
|
#include "eggbitset.h"
|
||||||
|
|
||||||
#define MAX_STACK_DEPTH 1024
|
#define MAX_STACK_DEPTH 1024
|
||||||
|
#define INLINE_AUGMENT_SIZE (GLIB_SIZEOF_VOID_P*2)
|
||||||
|
|
||||||
static GType
|
static GType
|
||||||
sysprof_callgraph_get_item_type (GListModel *model)
|
sysprof_callgraph_get_item_type (GListModel *model)
|
||||||
@ -74,7 +75,8 @@ static SysprofSymbol *untraceable;
|
|||||||
static void
|
static void
|
||||||
sysprof_callgraph_summary_free_all (SysprofCallgraphSummary *summary)
|
sysprof_callgraph_summary_free_all (SysprofCallgraphSummary *summary)
|
||||||
{
|
{
|
||||||
g_clear_pointer (&summary->augment, g_free);
|
g_clear_pointer (&summary->augment[0], g_free);
|
||||||
|
summary->augment[1] = NULL;
|
||||||
g_clear_pointer (&summary->callers, g_ptr_array_unref);
|
g_clear_pointer (&summary->callers, g_ptr_array_unref);
|
||||||
g_clear_pointer (&summary->traceables, egg_bitset_unref);
|
g_clear_pointer (&summary->traceables, egg_bitset_unref);
|
||||||
g_free (summary);
|
g_free (summary);
|
||||||
@ -83,7 +85,8 @@ sysprof_callgraph_summary_free_all (SysprofCallgraphSummary *summary)
|
|||||||
static void
|
static void
|
||||||
sysprof_callgraph_summary_free_self (SysprofCallgraphSummary *summary)
|
sysprof_callgraph_summary_free_self (SysprofCallgraphSummary *summary)
|
||||||
{
|
{
|
||||||
summary->augment = NULL;
|
summary->augment[0] = NULL;
|
||||||
|
summary->augment[1] = NULL;
|
||||||
g_clear_pointer (&summary->callers, g_ptr_array_unref);
|
g_clear_pointer (&summary->callers, g_ptr_array_unref);
|
||||||
g_clear_pointer (&summary->traceables, egg_bitset_unref);
|
g_clear_pointer (&summary->traceables, egg_bitset_unref);
|
||||||
g_free (summary);
|
g_free (summary);
|
||||||
@ -98,7 +101,6 @@ sysprof_callgraph_get_summary (SysprofCallgraph *self,
|
|||||||
if G_UNLIKELY (!(summary = g_hash_table_lookup (self->symbol_to_summary, symbol)))
|
if G_UNLIKELY (!(summary = g_hash_table_lookup (self->symbol_to_summary, symbol)))
|
||||||
{
|
{
|
||||||
summary = g_new0 (SysprofCallgraphSummary, 1);
|
summary = g_new0 (SysprofCallgraphSummary, 1);
|
||||||
summary->augment = NULL;
|
|
||||||
summary->traceables = egg_bitset_new_empty ();
|
summary->traceables = egg_bitset_new_empty ();
|
||||||
summary->callers = g_ptr_array_new ();
|
summary->callers = g_ptr_array_new ();
|
||||||
summary->symbol = symbol;
|
summary->symbol = symbol;
|
||||||
@ -399,7 +401,7 @@ _sysprof_callgraph_new_async (SysprofDocument *document,
|
|||||||
g_return_if_fail (G_IS_LIST_MODEL (traceables));
|
g_return_if_fail (G_IS_LIST_MODEL (traceables));
|
||||||
g_return_if_fail (!cancellable || G_IS_CANCELLABLE (cancellable));
|
g_return_if_fail (!cancellable || G_IS_CANCELLABLE (cancellable));
|
||||||
|
|
||||||
if (augment_size > GLIB_SIZEOF_VOID_P)
|
if (augment_size > INLINE_AUGMENT_SIZE)
|
||||||
summary_free = (GDestroyNotify)sysprof_callgraph_summary_free_all;
|
summary_free = (GDestroyNotify)sysprof_callgraph_summary_free_all;
|
||||||
else
|
else
|
||||||
summary_free = (GDestroyNotify)sysprof_callgraph_summary_free_self;
|
summary_free = (GDestroyNotify)sysprof_callgraph_summary_free_self;
|
||||||
@ -441,7 +443,7 @@ get_augmentation (SysprofCallgraph *self,
|
|||||||
if (self->augment_size == 0)
|
if (self->augment_size == 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (self->augment_size <= GLIB_SIZEOF_VOID_P)
|
if (self->augment_size <= INLINE_AUGMENT_SIZE)
|
||||||
return augment_location;
|
return augment_location;
|
||||||
|
|
||||||
if (*augment_location == NULL)
|
if (*augment_location == NULL)
|
||||||
@ -457,7 +459,7 @@ sysprof_callgraph_get_augment (SysprofCallgraph *self,
|
|||||||
if (node == NULL)
|
if (node == NULL)
|
||||||
node = &self->root;
|
node = &self->root;
|
||||||
|
|
||||||
return get_augmentation (self, &node->augment);
|
return get_augmentation (self, &node->augment[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
gpointer
|
gpointer
|
||||||
@ -467,7 +469,7 @@ sysprof_callgraph_get_summary_augment (SysprofCallgraph *self,
|
|||||||
if (node == NULL)
|
if (node == NULL)
|
||||||
node = &self->root;
|
node = &self->root;
|
||||||
|
|
||||||
return get_augmentation (self, &node->summary->augment);
|
return get_augmentation (self, &node->summary->augment[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
gpointer
|
gpointer
|
||||||
@ -480,7 +482,7 @@ _sysprof_callgraph_get_symbol_augment (SysprofCallgraph *self,
|
|||||||
g_return_val_if_fail (SYSPROF_IS_SYMBOL (symbol), NULL);
|
g_return_val_if_fail (SYSPROF_IS_SYMBOL (symbol), NULL);
|
||||||
|
|
||||||
if ((summary = g_hash_table_lookup (self->symbol_to_summary, symbol)))
|
if ((summary = g_hash_table_lookup (self->symbol_to_summary, symbol)))
|
||||||
return get_augmentation (self, &summary->augment);
|
return get_augmentation (self, &summary->augment[0]);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user