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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
|
/* -----------------------------------------------------------------------------
* $Id: Profiling.h,v 1.5 1999/04/23 09:47:30 simonm Exp $
*
* (c) The GHC Team, 1998-1999
*
* Cost-Centre Stack Profiling Include
*
* ---------------------------------------------------------------------------*/
#ifndef PROFILING_H
#define PROFILING_H
#if !defined(PROFILING)
#define CCS_ALLOC(ccs, amount) doNothing()
#define ENTER_CC_PAP_CL(r) doNothing()
#define ENTER_CCS_PAP_CL(r) doNothing()
#else /* PROFILING... */
/* -----------------------------------------------------------------------------
* Constants
* ---------------------------------------------------------------------------*/
#define EMPTY_STACK NULL
#define EMPTY_TABLE NULL
/* Constants used to set sumbsumed flag on CostCentres */
#define CC_IS_CAF 'c' /* 'c' => *is* a CAF cc */
#define CC_IS_SUBSUMED 's' /* 's' => *is* a subsumed cc */
#define CC_IS_BORING 'B' /* 'B' => *not* a CAF/sub cc */
/* Constants used for abreviated output of data in binary format. The order
* is important and corresponds to the "item" elementType in the XML log
* description. */
#define END_TAG 0
#define CC_TAG 1
#define CCS_TAG 2
#define TYPE_CON_TAG 3
#define HEAP_OBJ_TAG 4
#define TIME_UPDATE_TAG 5
#define HEAP_UPDATE_TAG 6
/* -----------------------------------------------------------------------------
* Data Structures
* ---------------------------------------------------------------------------*/
/*
* CostCentre
*/
typedef struct _CostCentre {
int ccID;
char *label;
char *module;
char *group;
char is_subsumed;
struct _CostCentre *link;
} CostCentre;
/*
* CostCentreStack
*/
typedef struct _CostCentreStack {
int ccsID;
CostCentre *cc;
struct _CostCentreStack *prevStack;
struct _IndexTable *indexTable;
unsigned long scc_count;
unsigned long sub_scc_count;
unsigned long sub_cafcc_count;
unsigned long time_ticks;
unsigned long mem_alloc;
CostCentre *root;
} CostCentreStack;
/*
* IndexTable
*/
typedef struct _IndexTable {
CostCentre *cc;
CostCentreStack *ccs;
struct _IndexTable *next;
} IndexTable;
/*
* CCSDeclist
*/
typedef struct _CCSDecList {
CostCentreStack *ccs;
struct _CCSDecList *nextList;
} CCSDecList;
/* -----------------------------------------------------------------------------
Pre-defined cost centres and cost centre stacks
-------------------------------------------------------------------------- */
extern CostCentreStack *CCCS; /* current CCS */
extern CostCentre CC_MAIN[];
extern CostCentreStack CCS_MAIN[]; /* Top CCS */
extern CostCentre CC_SYSTEM[];
extern CostCentreStack CCS_SYSTEM[]; /* RTS costs */
extern CostCentre CC_GC[];
extern CostCentreStack CCS_GC[]; /* Garbage collector costs */
extern CostCentre CC_SUBSUMED[];
extern CostCentreStack CCS_SUBSUMED[]; /* Costs are subsumed by caller */
extern CostCentre CC_OVERHEAD[];
extern CostCentreStack CCS_OVERHEAD[]; /* Profiling overhead */
extern CostCentre CC_DONTZuCARE[];
extern CostCentreStack CCS_DONTZuCARE[]; /* shouldn't ever get set */
extern unsigned int CC_ID; /* global id's */
extern unsigned int CCS_ID;
extern unsigned int HP_ID;
extern unsigned int interval_ticks;
extern unsigned int earlier_ticks;
typedef unsigned int hash_t;
extern hash_t time_intervals;
/* In RtsFlags.c, these are used to specify how to hash the data for
* output. None of this is necessary now since the viewer will be in
* charge of ordering and displaying output. */
extern hash_t max_cc_no; /* Hash on CC ptr */
extern hash_t max_mod_no; /* Hash on CC module */
extern hash_t max_grp_no; /* Hash on CC group */
extern hash_t max_descr_no; /* Hash on closure description */
extern hash_t max_type_no; /* Hash on type description */
/* -----------------------------------------------------------------------------
* Functions
* ---------------------------------------------------------------------------*/
CostCentreStack *EnterFunCCS ( CostCentreStack *cccs, CostCentreStack *ccsfn );
CostCentreStack *PushCostCentre ( CostCentreStack *, CostCentre * );
CostCentreStack *AppendCCS ( CostCentreStack *ccs1, CostCentreStack *ccs2 );
CostCentreStack *ActualPush ( CostCentreStack *, CostCentre * );
CostCentreStack *RemoveCC ( CostCentreStack *, CostCentre * );
CostCentreStack *IsInIndexTable ( IndexTable *, CostCentre * );
IndexTable *AddToIndexTable ( IndexTable *, CostCentreStack *, CostCentre * );
extern unsigned int entering_PAP;
#endif /* PROFILING */
#endif PROFILING_H
|