diff --git a/src/libsysprof-analyze/sysprof-callgraph.c b/src/libsysprof-analyze/sysprof-callgraph.c index 555345c6..b6461dad 100644 --- a/src/libsysprof-analyze/sysprof-callgraph.c +++ b/src/libsysprof-analyze/sysprof-callgraph.c @@ -532,6 +532,38 @@ sysprof_callgraph_list_traceables_for_symbol (SysprofCallgraph *self, return G_LIST_MODEL (g_list_store_new (SYSPROF_TYPE_DOCUMENT_TRACEABLE)); } +GListModel * +sysprof_callgraph_list_traceables_for_symbols_matching (SysprofCallgraph *self, + const char *pattern) +{ + g_autoptr(GPatternSpec) pspec = NULL; + g_autoptr(EggBitset) bitset = NULL; + + g_return_val_if_fail (SYSPROF_IS_CALLGRAPH (self), NULL); + + if (pattern == NULL || pattern[0] == 0) + return g_object_ref (self->traceables); + + pspec = g_pattern_spec_new (pattern); + bitset = egg_bitset_new_empty (); + + for (guint i = 0; i < self->symbols->len; i++) + { + SysprofSymbol *symbol = g_ptr_array_index (self->symbols, i); + const char *name = sysprof_symbol_get_name (symbol); + + if (g_pattern_spec_match (pspec, strlen (name), name, NULL)) + { + SysprofCallgraphSummary *summary = g_hash_table_lookup (self->symbol_to_summary, symbol); + + if (summary != NULL) + egg_bitset_union (bitset, summary->traceables); + } + } + + return _sysprof_document_bitset_index_new (self->traceables, bitset); +} + /** * sysprof_callgraph_list_symbols: * @self: a #SysprofCallgraph diff --git a/src/libsysprof-analyze/sysprof-callgraph.h b/src/libsysprof-analyze/sysprof-callgraph.h index 2873effa..4f476d31 100644 --- a/src/libsysprof-analyze/sysprof-callgraph.h +++ b/src/libsysprof-analyze/sysprof-callgraph.h @@ -79,6 +79,9 @@ SYSPROF_AVAILABLE_IN_ALL GListModel *sysprof_callgraph_list_traceables_for_symbol (SysprofCallgraph *self, SysprofSymbol *symbol); SYSPROF_AVAILABLE_IN_ALL +GListModel *sysprof_callgraph_list_traceables_for_symbols_matching (SysprofCallgraph *self, + const char *pattern); +SYSPROF_AVAILABLE_IN_ALL void sysprof_callgraph_descendants_async (SysprofCallgraph *self, SysprofSymbol *symbol, GCancellable *cancellable,