main.c: Remove unused variables
[memprof.git] / src / stackstash.h
blob02f8ac6252865c1fe46706e7cf6b6a7a6a7d9833
1 /* Sysprof -- Sampling, systemwide CPU profiler
2 * Copyright 2004, Red Hat, Inc.
3 * Copyright 2004, 2005, Soeren Sandmann
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 2 of the License, or
8 * (at your option) any later version.
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.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 #ifndef STACK_STASH_H
21 #define STACK_STASH_H
23 #include <glib.h>
25 typedef struct StackStash StackStash;
26 typedef struct StackNode StackNode;
28 struct StackNode
30 gpointer address;
32 guint total : 32;
33 guint size : 31;
34 guint toplevel : 1;
36 StackNode * parent;
37 StackNode * siblings;
38 StackNode * children;
40 StackNode * next;
43 typedef void (* StackFunction) (GList *trace,
44 gint size,
45 gpointer data);
47 typedef void (* StackNodeFunc) (StackNode *node,
48 gpointer data);
50 /* Stach */
51 StackStash *stack_stash_new (GDestroyNotify destroy);
52 StackNode * stack_node_new (StackStash *stash);
53 StackNode * stack_stash_add_trace (StackStash *stash,
54 gpointer *addrs,
55 gint n_addrs,
56 int size);
57 void stack_stash_foreach (StackStash *stash,
58 StackFunction stack_func,
59 gpointer data);
60 void stack_node_foreach_trace (StackNode *node,
61 StackFunction stack_func,
62 gpointer data);
63 StackNode *stack_stash_find_node (StackStash *stash,
64 gpointer address);
65 void stack_stash_foreach_by_address (StackStash *stash,
66 StackNodeFunc func,
67 gpointer data);
68 StackNode *stack_stash_get_root (StackStash *stash);
69 StackStash *stack_stash_ref (StackStash *stash);
70 void stack_stash_unref (StackStash *stash);
71 void stack_stash_set_root (StackStash *stash,
72 StackNode *root);
74 #endif