1 /* -----------------------------------------------------------------------------
2 * $Id: Profiling.h,v 1.2 1998/12/02 13:21:19 simonm Exp $
4 * Cost-Centre Stack Profiling Include
5 * ---------------------------------------------------------------------------*/
11 #if !defined(PROFILING)
13 #define CCS_ALLOC(ccs, amount) doNothing()
14 #define ENTER_CC_PAP_CL(r) doNothing()
15 #define ENTER_CCS_PAP_CL(r) doNothing()
17 #else /* PROFILING... */
19 /* -----------------------------------------------------------------------------
21 * ---------------------------------------------------------------------------*/
23 #define EMPTY_STACK NULL
24 #define EMPTY_TABLE NULL
26 /* Constants used to set sumbsumed flag on CostCentres */
28 #define CC_IS_CAF 'c' /* 'c' => *is* a CAF cc */
29 #define CC_IS_DICT 'd' /* 'd' => *is* a dictionary cc */
30 #define CC_IS_SUBSUMED 's' /* 's' => *is* a subsumed cc */
31 #define CC_IS_BORING 'B' /* 'B' => *not* a CAF/dict/sub cc */
33 /* Constants used for abreviated output of data in binary format. The order
34 * is important and corresponds to the "item" elementType in the XML log
40 #define TYPE_CON_TAG 3
41 #define HEAP_OBJ_TAG 4
42 #define TIME_UPDATE_TAG 5
43 #define HEAP_UPDATE_TAG 6
46 /* -----------------------------------------------------------------------------
48 * ---------------------------------------------------------------------------*/
53 typedef struct _CostCentre {
62 struct _CostCentre *link;
71 typedef struct _CostCentreStack {
75 struct _CostCentreStack *prevStack;
76 struct _IndexTable *indexTable;
78 unsigned long scc_count;
79 unsigned long sub_scc_count;
80 unsigned long sub_cafcc_count;
81 unsigned long sub_dictcc_count;
83 unsigned long time_ticks;
84 unsigned long mem_alloc;
86 char is_subsumed; /* inherits value from is_subsumed flag of top CostCentre */
95 typedef struct _IndexTable {
98 struct _IndexTable *next;
106 typedef struct _CCSDecList {
107 CostCentreStack *ccs;
108 struct _CCSDecList *nextList;
112 /* -----------------------------------------------------------------------------
113 Pre-defined cost centres and cost centre stacks
114 -------------------------------------------------------------------------- */
116 extern CostCentreStack *CCCS; /* current CCS */
118 extern CostCentre CC_MAIN[];
119 extern CostCentreStack CCS_MAIN[]; /* Top CCS */
121 extern CostCentre CC_SYSTEM[];
122 extern CostCentreStack CCS_SYSTEM[]; /* RTS costs */
124 extern CostCentre CC_GC[];
125 extern CostCentreStack CCS_GC[]; /* Garbage collector costs */
127 extern CostCentre CC_SUBSUMED[];
128 extern CostCentreStack CCS_SUBSUMED[]; /* Costs are subsumed by caller */
130 extern CostCentre CC_OVERHEAD[];
131 extern CostCentreStack CCS_OVERHEAD[]; /* Profiling overhead */
133 extern CostCentre CC_DONTZuCARE[];
134 extern CostCentreStack CCS_DONTZuCARE[]; /* shouldn't ever get set */
136 extern unsigned int CC_ID; /* global id's */
137 extern unsigned int CCS_ID;
138 extern unsigned int HP_ID;
140 extern unsigned int interval_ticks;
141 extern unsigned int earlier_ticks;
143 typedef unsigned int hash_t;
144 extern hash_t time_intervals;
146 /* In RtsFlags.c, these are used to specify how to hash the data for
147 * output. None of this is necessary now since the viewer will be in
148 * charge of ordering and displaying output. */
149 extern hash_t max_cc_no; /* Hash on CC ptr */
150 extern hash_t max_mod_no; /* Hash on CC module */
151 extern hash_t max_grp_no; /* Hash on CC group */
152 extern hash_t max_descr_no; /* Hash on closure description */
153 extern hash_t max_type_no; /* Hash on type description */
155 /* -----------------------------------------------------------------------------
157 * ---------------------------------------------------------------------------*/
159 CostCentreStack *PushCostCentre ( CostCentreStack *, CostCentre * );
160 CostCentreStack *ActualPush ( CostCentreStack *, CostCentre * );
161 CostCentreStack *RemoveCC ( CostCentreStack *, CostCentre * );
163 CostCentreStack *IsInIndexTable ( IndexTable *, CostCentre * );
164 IndexTable *AddToIndexTable ( IndexTable *, CostCentreStack *, CostCentre * );
166 #endif /* PROFILING */