| 1 |
/* sysprof-callgraph-private.h |
| 2 |
* |
| 3 |
* Copyright 2023 Christian Hergert <[email protected]> |
| 4 |
* |
| 5 |
* This program is free software: you can redistribute it and/or modify |
| 6 |
* it under the terms of the GNU General Public License as published by |
| 7 |
* the Free Software Foundation, either version 3 of the License, or |
| 8 |
* (at your option) any later version. |
| 9 |
* |
| 10 |
* This program is distributed in the hope that it will be useful, |
| 11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
* GNU General Public License for more details. |
| 14 |
* |
| 15 |
* You should have received a copy of the GNU General Public License |
| 16 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 |
* |
| 18 |
* SPDX-License-Identifier: GPL-3.0-or-later |
| 19 |
*/ |
| 20 |
|
| 21 |
#pragma once |
| 22 |
|
| 23 |
#include <gio/gio.h> |
| 24 |
|
| 25 |
#include "sysprof-allocator-private.h" |
| 26 |
#include "sysprof-callgraph.h" |
| 27 |
#include "sysprof-document.h" |
| 28 |
|
| 29 |
#include "eggbitset.h" |
| 30 |
|
| 31 |
G_BEGIN_DECLS |
| 32 |
|
| 33 |
#define SYSPROF_CALLGRAPH_CATEGORY_INHERIT (1 << 6) |
| 34 |
#define SYSPROF_CALLGRAPH_CATEGORY_UNMASK(c) (c & ~(SYSPROF_CALLGRAPH_CATEGORY_INHERIT)) |
| 35 |
|
| 36 |
typedef struct _SysprofCallgraphSummary |
| 37 |
{ |
| 38 |
SysprofSymbol *symbol; |
| 39 |
EggBitset *traceables; |
| 40 |
GPtrArray *callers; |
| 41 |
gpointer augment[2]; |
| 42 |
} SysprofCallgraphSummary; |
| 43 |
|
| 44 |
struct _SysprofCallgraphNode |
| 45 |
{ |
| 46 |
SysprofCallgraphNode *parent; |
| 47 |
SysprofCallgraphNode *prev; |
| 48 |
SysprofCallgraphNode *next; |
| 49 |
SysprofCallgraphNode *children; |
| 50 |
SysprofCallgraphSummary *summary; |
| 51 |
gpointer augment[2]; |
| 52 |
guint category : 7; |
| 53 |
guint is_toplevel : 1; |
| 54 |
guint count : 24; |
| 55 |
}; |
| 56 |
|
| 57 |
struct _SysprofCallgraph |
| 58 |
{ |
| 59 |
GObject parent_instance; |
| 60 |
|
| 61 |
SysprofAllocator *allocator; |
| 62 |
|
| 63 |
SysprofDocument *document; |
| 64 |
GListModel *traceables; |
| 65 |
|
| 66 |
GHashTable *symbol_to_summary; |
| 67 |
GPtrArray *symbols; |
| 68 |
|
| 69 |
SysprofCallgraphFlags flags; |
| 70 |
|
| 71 |
gsize augment_size; |
| 72 |
SysprofAugmentationFunc augment_func; |
| 73 |
gpointer augment_func_data; |
| 74 |
GDestroyNotify augment_func_data_destroy; |
| 75 |
|
| 76 |
SysprofCallgraphNode root; |
| 77 |
|
| 78 |
guint height; |
| 79 |
}; |
| 80 |
|
| 81 |
void _sysprof_callgraph_new_async (SysprofDocument *document, |
| 82 |
SysprofCallgraphFlags flags, |
| 83 |
GListModel *traceables, |
| 84 |
gsize augment_size, |
| 85 |
SysprofAugmentationFunc augment_func, |
| 86 |
gpointer augment_func_data, |
| 87 |
GDestroyNotify augment_func_data_destroy, |
| 88 |
GCancellable *cancellable, |
| 89 |
GAsyncReadyCallback callback, |
| 90 |
gpointer user_data); |
| 91 |
SysprofCallgraph *_sysprof_callgraph_new_finish (GAsyncResult *result, |
| 92 |
GError **error); |
| 93 |
gpointer _sysprof_callgraph_get_symbol_augment (SysprofCallgraph *self, |
| 94 |
SysprofSymbol *symbol); |
| 95 |
void _sysprof_callgraph_node_free (SysprofCallgraphNode *self, |
| 96 |
gboolean free_self); |
| 97 |
SysprofCallgraphCategory _sysprof_callgraph_node_categorize (SysprofCallgraphNode *node); |
| 98 |
void _sysprof_callgraph_categorize (SysprofCallgraph *self, |
| 99 |
SysprofCallgraphNode *node); |
| 100 |
const char *_sysprof_callgraph_category_get_name (SysprofCallgraphCategory category); |
| 101 |
|
| 102 |
G_END_DECLS |