From fbe0b99314cb9e7396cec58f0cfbdecef08b0838 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Mon, 12 Jun 2023 11:34:42 -0700 Subject: [PATCH] libsysprof-analyze: use symbol to get callers list That keeps the API clear of the indirection Frame object so we can use it elsewhere like in the functions column view to select callees. --- src/libsysprof-analyze/sysprof-callgraph.c | 21 ++++++++------------- src/libsysprof-analyze/sysprof-callgraph.h | 2 +- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/src/libsysprof-analyze/sysprof-callgraph.c b/src/libsysprof-analyze/sysprof-callgraph.c index c61ba0fb..0e5be21a 100644 --- a/src/libsysprof-analyze/sysprof-callgraph.c +++ b/src/libsysprof-analyze/sysprof-callgraph.c @@ -464,30 +464,25 @@ sysprof_callgraph_node_parent (SysprofCallgraphNode *node) /** * sysprof_callgraph_list_callers: * @self: a #SysprofCallgraph - * @node: a #SysprofCallgraphFrame + * @symbol: a #SysprofSymbol * - * Gets a list of #SysprofSymbol that call @node. + * Gets a list of #SysprofSymbol that call @symbol. * - * Returns: (trasfer full): a #GListModel of #SysprofSymbol + * Returns: (trasfer full): a #GListModel of #SysprofCallgraphSymbol */ GListModel * -sysprof_callgraph_list_callers (SysprofCallgraph *self, - SysprofCallgraphFrame *frame) +sysprof_callgraph_list_callers (SysprofCallgraph *self, + SysprofSymbol *symbol) { SysprofCallgraphSummary *summary; - SysprofSymbol *symbol; - GListStore *store; g_return_val_if_fail (SYSPROF_IS_CALLGRAPH (self), NULL); - g_return_val_if_fail (SYSPROF_IS_CALLGRAPH_FRAME (frame), NULL); - - store = g_list_store_new (SYSPROF_TYPE_SYMBOL); - symbol = sysprof_callgraph_frame_get_symbol (frame); + g_return_val_if_fail (SYSPROF_IS_SYMBOL (symbol), NULL); if ((summary = g_hash_table_lookup (self->symbol_to_summary, symbol))) - g_list_store_splice (store, 0, 0, summary->callers->pdata, summary->callers->len); + return _sysprof_callgraph_symbol_list_model_new (self, summary->callers); - return G_LIST_MODEL (store); + return G_LIST_MODEL (g_list_store_new (SYSPROF_TYPE_CALLGRAPH_SYMBOL)); } /** diff --git a/src/libsysprof-analyze/sysprof-callgraph.h b/src/libsysprof-analyze/sysprof-callgraph.h index 3dfbad4b..5f3afe3c 100644 --- a/src/libsysprof-analyze/sysprof-callgraph.h +++ b/src/libsysprof-analyze/sysprof-callgraph.h @@ -61,7 +61,7 @@ SYSPROF_AVAILABLE_IN_ALL GListModel *sysprof_callgraph_list_symbols (SysprofCallgraph *self); SYSPROF_AVAILABLE_IN_ALL GListModel *sysprof_callgraph_list_callers (SysprofCallgraph *self, - SysprofCallgraphFrame *frame); + SysprofSymbol *symbol); SYSPROF_AVAILABLE_IN_ALL GListModel *sysprof_callgraph_list_traceables_for_symbol (SysprofCallgraph *self, SysprofSymbol *symbol);