summaryrefslogtreecommitdiff
path: root/profile.h
blob: ed016da20913f4806f5d552ba9daadc25efb5eb8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/* Sysprof -- Sampling, systemwide CPU profiler
 * Copyright 2004, Red Hat, Inc.
 * Copyright 2004, 2005, Soeren Sandmann
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */

#ifndef PROFILE_H
#define PROFILE_H

#include <glib.h>
#include "stackstash.h"

typedef struct Profile Profile;
typedef struct ProfileObject ProfileObject;
typedef struct ProfileDescendant ProfileDescendant;
typedef struct ProfileCaller ProfileCaller;

struct ProfileObject
{
    char *		name;		/* identifies this object uniquely
					 * (the pointer itself, not the
					 *  string)
					 */
    
    guint		total;		/* sum of all toplevel totals */
    guint		self;		/* sum of all selfs */
};

struct ProfileDescendant
{
    char *		name;
    guint		self;
    guint		cumulative;
    ProfileDescendant * parent;
    ProfileDescendant * siblings;
    ProfileDescendant * children;
};

struct ProfileCaller
{
    char *		name;
    guint		total;
    guint		self;

    ProfileCaller *	next;
};

Profile *          profile_new                (StackStash        *stash);
void               profile_free               (Profile           *profile);
gint		   profile_get_size	      (Profile           *profile);
GList *		   profile_get_objects	      (Profile		 *profile);
ProfileDescendant *profile_create_descendants (Profile           *prf,
					       char		 *object);
ProfileCaller *	   profile_list_callers       (Profile		 *profile,
					       char              *object);
void		   profile_caller_free	      (ProfileCaller     *caller);
void               profile_descendant_free    (ProfileDescendant *descendant);

gboolean	   profile_save		      (Profile		 *profile,
					       const char	 *file_name,
					       GError		**err);
Profile *	   profile_load		      (const char	 *filename,
					       GError           **err);

#endif /* PROFILE_H */