mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
libsysprof-analyze: add GListModel of callgraph symbols
This has an indirect object (SysprofCallgraphSymbol) so that we can provide plumbing to get the callgraph as well as the augmented data from the indirection object. This allows for callgraphs to show overview in the functions list which contains the same augmentation that the descendants view does.
This commit is contained in:
@ -22,6 +22,7 @@
|
||||
|
||||
#include "sysprof-callgraph-private.h"
|
||||
#include "sysprof-callgraph-frame-private.h"
|
||||
#include "sysprof-callgraph-symbol-private.h"
|
||||
#include "sysprof-document-bitset-index-private.h"
|
||||
#include "sysprof-document-private.h"
|
||||
#include "sysprof-document-traceable.h"
|
||||
@ -31,23 +32,6 @@
|
||||
|
||||
#define MAX_STACK_DEPTH 1024
|
||||
|
||||
struct _SysprofCallgraph
|
||||
{
|
||||
GObject parent_instance;
|
||||
|
||||
SysprofDocument *document;
|
||||
GListModel *traceables;
|
||||
|
||||
GHashTable *symbol_to_summary;
|
||||
|
||||
gsize augment_size;
|
||||
SysprofAugmentationFunc augment_func;
|
||||
gpointer augment_func_data;
|
||||
GDestroyNotify augment_func_data_destroy;
|
||||
|
||||
SysprofCallgraphNode root;
|
||||
};
|
||||
|
||||
static GType
|
||||
sysprof_callgraph_get_item_type (GListModel *model)
|
||||
{
|
||||
@ -119,6 +103,7 @@ sysprof_callgraph_get_summary (SysprofCallgraph *self,
|
||||
summary->symbol = symbol;
|
||||
|
||||
g_hash_table_insert (self->symbol_to_summary, symbol, summary);
|
||||
g_ptr_array_add (self->symbols, symbol);
|
||||
}
|
||||
|
||||
return summary;
|
||||
@ -400,6 +385,7 @@ _sysprof_callgraph_new_async (SysprofDocument *document,
|
||||
self->augment_func_data = augment_func_data;
|
||||
self->augment_func_data_destroy = augment_func_data_destroy;
|
||||
self->symbol_to_summary = g_hash_table_new_full (NULL, NULL, NULL, summary_free);
|
||||
self->symbols = g_ptr_array_new ();
|
||||
self->root.summary = sysprof_callgraph_get_summary (self, everything);
|
||||
|
||||
task = g_task_new (NULL, cancellable, callback, user_data);
|
||||
@ -453,6 +439,21 @@ sysprof_callgraph_get_summary_augment (SysprofCallgraph *self,
|
||||
return get_augmentation (self, &node->summary->augment);
|
||||
}
|
||||
|
||||
gpointer
|
||||
_sysprof_callgraph_get_symbol_augment (SysprofCallgraph *self,
|
||||
SysprofSymbol *symbol)
|
||||
{
|
||||
SysprofCallgraphSummary *summary;
|
||||
|
||||
g_return_val_if_fail (SYSPROF_IS_CALLGRAPH (self), NULL);
|
||||
g_return_val_if_fail (SYSPROF_IS_SYMBOL (symbol), NULL);
|
||||
|
||||
if ((summary = g_hash_table_lookup (self->symbol_to_summary, symbol)))
|
||||
return get_augmentation (self, &summary->augment);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SysprofCallgraphNode *
|
||||
sysprof_callgraph_node_parent (SysprofCallgraphNode *node)
|
||||
{
|
||||
@ -512,3 +513,20 @@ sysprof_callgraph_list_traceables_for_symbol (SysprofCallgraph *self,
|
||||
|
||||
return G_LIST_MODEL (g_list_store_new (SYSPROF_TYPE_DOCUMENT_TRACEABLE));
|
||||
}
|
||||
|
||||
/**
|
||||
* sysprof_callgraph_list_symbols:
|
||||
* @self: a #SysprofCallgraph
|
||||
*
|
||||
* Gets a #GListModel of #SysprofCallgraphSymbol that an be used to
|
||||
* display a function list and associated augmentation data.
|
||||
*
|
||||
* Returns: (transfer full): a #GListModel of #SysprofCallgraphSymbol
|
||||
*/
|
||||
GListModel *
|
||||
sysprof_callgraph_list_symbols (SysprofCallgraph *self)
|
||||
{
|
||||
g_return_val_if_fail (SYSPROF_IS_CALLGRAPH (self), NULL);
|
||||
|
||||
return _sysprof_callgraph_symbol_list_model_new (self);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user