1 /* MemProf -- memory profiler and leak detector
2 * Copyright 2002, Soeren Sandmann (sandmann@daimi.au.dk)
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 typedef struct ProfileNode ProfileNode
;
25 typedef struct Profile Profile
;
26 typedef struct ProfileFunc ProfileFunc
;
27 typedef struct ProfileDescendantTree ProfileDescendantTree
;
28 typedef struct ProfileDescendantTreeNode ProfileDescendantTreeNode
;
35 gboolean toplevel
; /* whether the node is the first for this function
39 ProfileNode
* next
; /* chains together nodes with matching symbols */
45 struct ProfileDescendantTreeNode
54 ProfileDescendantTreeNode
*parent
;
56 gint marked_non_recursive
;
57 gboolean marked_total
;
60 struct ProfileDescendantTree
{
65 guint total
; /* sum of all toplevel totals */
66 guint self
; /* sum of all selfs */
72 GPtrArray
* roots
; /* root nodes of call tree */
73 GPtrArray
* functions
;
74 guint n_bytes
; /* total number of bytes profiled */
78 GHashTable
*nodes_by_symbol
;
81 Profile
* profile_create (MPProcess
*process
,
83 void profile_free (Profile
*profile
);
84 ProfileDescendantTree
*profile_func_create_descendant_tree (ProfileFunc
*func
);
85 void profile_descendant_tree_free (ProfileDescendantTree
*descendant_tree
);
86 GPtrArray
* profile_func_create_caller_list (ProfileFunc
*func
);
87 void profile_caller_list_free (GPtrArray
*caller_list
);
88 void profile_write (Profile
*profile
, const gchar
*outfile
);