ticky enhancements
[ghc.git] / includes / stg / Ticky.h
1 /* -----------------------------------------------------------------------------
2 *
3 * (c) The GHC Team, 2009
4 *
5 * Declarations for counters used by ticky-ticky profiling.
6 *
7 * Do not #include this file directly: #include "Rts.h" instead.
8 *
9 * To understand the structure of the RTS headers, see the wiki:
10 * http://hackage.haskell.org/trac/ghc/wiki/Commentary/SourceTree/Includes
11 *
12 * -------------------------------------------------------------------------- */
13
14
15 #ifndef TICKYCOUNTERS_H
16 #define TICKYCOUNTERS_H
17
18 /* These should probably be automatically generated in order to
19 keep them consistent with the macros that use them (which are
20 defined in Cmm.h) */
21
22 /* Here are all the counter declarations: */
23 /* If you change this list, make the corresponding change
24 in RTS_TICKY_SYMBOLS in rts/Linker.c */
25
26 /* These two are explicitly declared in rts/Ticky.c, and
27 hence should not be extern'd except when using this header
28 file from STG code; hence IN_STG_CODE */
29
30 #if IN_STG_CODE
31 extern W_ ticky_entry_ctrs[];
32 extern W_ top_ct[];
33 #endif
34
35 /* The rest are not explicity declared in rts/Ticky.c. Instead
36 we use the same trick as in the former StgTicky.h: recycle the
37 same declarations for both extern decls (which are included everywhere)
38 and initializations (which only happen once)
39 TICKY_C is defined only in rts/Ticky.c */
40 #ifdef TICKY_C
41 #define INIT(ializer) = ializer
42 #define EXTERN
43 #else
44 #define INIT(ializer)
45 #define EXTERN extern
46 #endif
47
48 EXTERN StgInt ENT_VIA_NODE_ctr INIT(0);
49 EXTERN StgInt ENT_STATIC_THK_ctr INIT(0);
50 EXTERN StgInt ENT_DYN_THK_ctr INIT(0);
51 EXTERN StgInt ENT_STATIC_FUN_DIRECT_ctr INIT(0);
52 EXTERN StgInt ENT_DYN_FUN_DIRECT_ctr INIT(0);
53 EXTERN StgInt ENT_STATIC_CON_ctr INIT(0);
54 EXTERN StgInt ENT_DYN_CON_ctr INIT(0);
55 EXTERN StgInt ENT_STATIC_IND_ctr INIT(0);
56 EXTERN StgInt ENT_DYN_IND_ctr INIT(0);
57 EXTERN StgInt ENT_PERM_IND_ctr INIT(0);
58 EXTERN StgInt ENT_PAP_ctr INIT(0);
59 EXTERN StgInt ENT_AP_ctr INIT(0);
60 EXTERN StgInt ENT_AP_STACK_ctr INIT(0);
61 EXTERN StgInt ENT_BH_ctr INIT(0);
62 EXTERN StgInt ENT_LNE_ctr INIT(0);
63
64 EXTERN StgInt UNKNOWN_CALL_ctr INIT(0);
65
66 EXTERN StgInt SLOW_CALL_fast_v16_ctr INIT(0);
67 EXTERN StgInt SLOW_CALL_fast_v_ctr INIT(0);
68 EXTERN StgInt SLOW_CALL_fast_f_ctr INIT(0);
69 EXTERN StgInt SLOW_CALL_fast_d_ctr INIT(0);
70 EXTERN StgInt SLOW_CALL_fast_l_ctr INIT(0);
71 EXTERN StgInt SLOW_CALL_fast_n_ctr INIT(0);
72 EXTERN StgInt SLOW_CALL_fast_p_ctr INIT(0);
73 EXTERN StgInt SLOW_CALL_fast_pv_ctr INIT(0);
74 EXTERN StgInt SLOW_CALL_fast_pp_ctr INIT(0);
75 EXTERN StgInt SLOW_CALL_fast_ppv_ctr INIT(0);
76 EXTERN StgInt SLOW_CALL_fast_ppp_ctr INIT(0);
77 EXTERN StgInt SLOW_CALL_fast_pppv_ctr INIT(0);
78 EXTERN StgInt SLOW_CALL_fast_pppp_ctr INIT(0);
79 EXTERN StgInt SLOW_CALL_fast_ppppp_ctr INIT(0);
80 EXTERN StgInt SLOW_CALL_fast_pppppp_ctr INIT(0);
81 EXTERN StgInt VERY_SLOW_CALL_ctr INIT(0);
82
83 EXTERN StgInt ticky_slow_call_unevald;
84 EXTERN StgInt SLOW_CALL_ctr INIT(0);
85 EXTERN StgInt MULTI_CHUNK_SLOW_CALL_ctr INIT(0);
86 EXTERN StgInt MULTI_CHUNK_SLOW_CALL_CHUNKS_ctr INIT(0);
87 EXTERN StgInt KNOWN_CALL_ctr INIT(0);
88 EXTERN StgInt KNOWN_CALL_TOO_FEW_ARGS_ctr INIT(0);
89 EXTERN StgInt KNOWN_CALL_EXTRA_ARGS_ctr INIT(0);
90 EXTERN StgInt SLOW_CALL_FUN_TOO_FEW_ctr INIT(0);
91 EXTERN StgInt SLOW_CALL_FUN_CORRECT_ctr INIT(0);
92 EXTERN StgInt SLOW_CALL_FUN_TOO_MANY_ctr INIT(0);
93 EXTERN StgInt SLOW_CALL_PAP_TOO_FEW_ctr INIT(0);
94 EXTERN StgInt SLOW_CALL_PAP_CORRECT_ctr INIT(0);
95 EXTERN StgInt SLOW_CALL_PAP_TOO_MANY_ctr INIT(0);
96 EXTERN StgInt SLOW_CALL_UNEVALD_ctr INIT(0);
97
98
99 EXTERN StgInt UPDF_OMITTED_ctr INIT(0);
100 EXTERN StgInt UPDF_PUSHED_ctr INIT(0);
101 EXTERN StgInt CATCHF_PUSHED_ctr INIT(0);
102 EXTERN StgInt UPDF_RCC_PUSHED_ctr INIT(0);
103 EXTERN StgInt UPDF_RCC_OMITTED_ctr INIT(0);
104
105 EXTERN StgInt UPD_SQUEEZED_ctr INIT(0);
106 EXTERN StgInt UPD_CON_IN_NEW_ctr INIT(0);
107 EXTERN StgInt UPD_CON_IN_PLACE_ctr INIT(0);
108 EXTERN StgInt UPD_PAP_IN_NEW_ctr INIT(0);
109 EXTERN StgInt UPD_PAP_IN_PLACE_ctr INIT(0);
110
111 EXTERN StgInt ALLOC_HEAP_ctr INIT(0);
112 EXTERN StgInt ALLOC_HEAP_tot INIT(0);
113
114 EXTERN StgInt ALLOC_RTS_ctr INIT(0);
115 EXTERN StgInt ALLOC_RTS_tot INIT(0);
116
117 EXTERN StgInt ALLOC_FUN_ctr INIT(0);
118 EXTERN StgInt ALLOC_FUN_adm INIT(0);
119 EXTERN StgInt ALLOC_FUN_gds INIT(0);
120 EXTERN StgInt ALLOC_FUN_slp INIT(0);
121
122 EXTERN StgInt UPD_NEW_IND_ctr INIT(0);
123 EXTERN StgInt UPD_NEW_PERM_IND_ctr INIT(0);
124 EXTERN StgInt UPD_OLD_IND_ctr INIT(0);
125 EXTERN StgInt UPD_OLD_PERM_IND_ctr INIT(0);
126
127 EXTERN StgInt UPD_BH_UPDATABLE_ctr INIT(0);
128 EXTERN StgInt UPD_BH_SINGLE_ENTRY_ctr INIT(0);
129 EXTERN StgInt UPD_CAF_BH_UPDATABLE_ctr INIT(0);
130 EXTERN StgInt UPD_CAF_BH_SINGLE_ENTRY_ctr INIT(0);
131
132 EXTERN StgInt GC_SEL_ABANDONED_ctr INIT(0);
133 EXTERN StgInt GC_SEL_MINOR_ctr INIT(0);
134 EXTERN StgInt GC_SEL_MAJOR_ctr INIT(0);
135
136 EXTERN StgInt GC_FAILED_PROMOTION_ctr INIT(0);
137
138 EXTERN StgInt ALLOC_UP_THK_ctr INIT(0);
139 EXTERN StgInt ALLOC_SE_THK_ctr INIT(0);
140 EXTERN StgInt ALLOC_THK_adm INIT(0);
141 EXTERN StgInt ALLOC_THK_gds INIT(0);
142 EXTERN StgInt ALLOC_THK_slp INIT(0);
143
144 EXTERN StgInt ALLOC_CON_ctr INIT(0);
145 EXTERN StgInt ALLOC_CON_adm INIT(0);
146 EXTERN StgInt ALLOC_CON_gds INIT(0);
147 EXTERN StgInt ALLOC_CON_slp INIT(0);
148
149 EXTERN StgInt ALLOC_TUP_ctr INIT(0);
150 EXTERN StgInt ALLOC_TUP_adm INIT(0);
151 EXTERN StgInt ALLOC_TUP_gds INIT(0);
152 EXTERN StgInt ALLOC_TUP_slp INIT(0);
153
154 EXTERN StgInt ALLOC_BH_ctr INIT(0);
155 EXTERN StgInt ALLOC_BH_adm INIT(0);
156 EXTERN StgInt ALLOC_BH_gds INIT(0);
157 EXTERN StgInt ALLOC_BH_slp INIT(0);
158
159 EXTERN StgInt ALLOC_PRIM_ctr INIT(0);
160 EXTERN StgInt ALLOC_PRIM_adm INIT(0);
161 EXTERN StgInt ALLOC_PRIM_gds INIT(0);
162 EXTERN StgInt ALLOC_PRIM_slp INIT(0);
163
164 EXTERN StgInt ALLOC_PAP_ctr INIT(0);
165 EXTERN StgInt ALLOC_PAP_adm INIT(0);
166 EXTERN StgInt ALLOC_PAP_gds INIT(0);
167 EXTERN StgInt ALLOC_PAP_slp INIT(0);
168
169 EXTERN StgInt ALLOC_TSO_ctr INIT(0);
170 EXTERN StgInt ALLOC_TSO_adm INIT(0);
171 EXTERN StgInt ALLOC_TSO_gds INIT(0);
172 EXTERN StgInt ALLOC_TSO_slp INIT(0);
173
174 EXTERN StgInt RET_NEW_ctr INIT(0);
175 EXTERN StgInt RET_OLD_ctr INIT(0);
176 EXTERN StgInt RET_UNBOXED_TUP_ctr INIT(0);
177
178 EXTERN StgInt RET_SEMI_loads_avoided INIT(0);
179
180 /* End of counter declarations. */
181
182 /* This is ugly, but the story is:
183 We got rid of StgTicky.h, which was previously
184 defining these macros for the benefit of C code
185 so, we define them here instead (to be no-ops).
186 (since those macros are only defined in Cmm.h)
187
188 Note that these macros must be defined whether
189 TICKY_TICKY is defined or not. */
190
191 #ifndef CMINUSMINUS
192 #define TICK_BUMP_BY(ctr,n) ctr = (StgInt) ctr + n
193 #define TICK_BUMP(ctr) TICK_BUMP_BY(ctr,1)
194
195 #define TICK_ALLOC_PRIM(x,y,z)
196 #define TICK_UPD_OLD_IND()
197 #define TICK_UPD_NEW_IND()
198 #define TICK_UPD_SQUEEZED()
199 #define TICK_ALLOC_HEAP_NOCTR(bytes)
200 #define TICK_GC_FAILED_PROMOTION()
201 #define TICK_ALLOC_TSO()
202 #define TICK_ALLOC_STACK(g)
203 #define TICK_ALLOC_UP_THK(g,s)
204 #define TICK_ALLOC_SE_THK(g,s)
205
206 #endif
207
208
209 #endif /* TICKYCOUNTERS_H */