merge upstream HEAD
[ghc-hetmet.git] / rts / Ticky.c
1 /* -----------------------------------------------------------------------------
2  *
3  * (c) The AQUA project, Glasgow University, 1992-1997
4  * (c) The GHC Team, 1998-1999
5  *
6  * Ticky-ticky profiling
7  *-------------------------------------------------------------------------- */
8
9 #define TICKY_C                 /* define those variables */
10 #include "PosixSource.h"
11 #include "Rts.h"
12
13 /* Catch-all top-level counter struct.  Allocations from CAFs will go
14  * here.
15  */
16 StgEntCounter top_ct
17         = { 0, 0, 0,
18             "TOP", "",
19             0, 0, NULL };
20
21 /* Data structure used in ``registering'' one of these counters. */
22
23 StgEntCounter *ticky_entry_ctrs = NULL; /* root of list of them */
24
25 /* We want Haskell code compiled with -ticky to be linkable with any
26  * version of the RTS, so we have to make sure all the symbols that
27  * ticky-compiled code may refer to are defined by every RTS. (#3439)
28  * Hence the #ifdef is here, rather than up above.
29  */
30 #if defined(TICKY_TICKY)
31
32 #include "Ticky.h"
33
34 /* -----------------------------------------------------------------------------
35    Print out all the counters
36    -------------------------------------------------------------------------- */
37
38 static void printRegisteredCounterInfo (FILE *); /* fwd decl */
39
40 #define INTAVG(a,b) ((b == 0) ? 0.0 : ((double) (a) / (double) (b)))
41 #define PC(a)       (100.0 * a)
42
43 #define AVG(thing) \
44         StgDouble avg##thing  = INTAVG(tot##thing,ctr##thing)
45
46 void
47 PrintTickyInfo(void)
48 {
49   // XXX This is only used in commented out or #if FALSE'd out code currently:
50   // unsigned long i;
51
52 /* XXX These are used only in an #if FALSE block below */
53 #if FALSE
54   unsigned long tot_allocs = /* total number of things allocated */
55         ALLOC_FUN_ctr + ALLOC_SE_THK_ctr + ALLOC_UP_THK_ctr + ALLOC_CON_ctr + ALLOC_TUP_ctr +
56         + ALLOC_TSO_ctr + ALLOC_BH_ctr  + ALLOC_PAP_ctr + ALLOC_PRIM_ctr
57       ; 
58
59   unsigned long tot_adm_wds = /* total number of admin words allocated */
60         ALLOC_FUN_adm + ALLOC_THK_adm + ALLOC_CON_adm + ALLOC_TUP_adm
61         + ALLOC_TSO_adm + ALLOC_BH_adm  + ALLOC_PAP_adm + ALLOC_PRIM_adm
62       ;
63
64   unsigned long tot_gds_wds = /* total number of words of ``good stuff'' allocated */
65         ALLOC_FUN_gds + ALLOC_THK_gds + ALLOC_CON_gds + ALLOC_TUP_gds
66         + ALLOC_TSO_gds + ALLOC_BH_gds  + ALLOC_PAP_gds + ALLOC_PRIM_gds
67       ;
68
69   unsigned long tot_slp_wds = /* total number of ``slop'' words allocated */
70         ALLOC_FUN_slp + ALLOC_THK_slp + ALLOC_CON_slp + ALLOC_TUP_slp
71         + ALLOC_TSO_slp + ALLOC_BH_slp  + ALLOC_PAP_slp + ALLOC_PRIM_slp
72       ;
73
74   unsigned long tot_wds = /* total words */
75         tot_adm_wds + tot_gds_wds + tot_slp_wds;
76 #endif
77
78   unsigned long tot_thk_enters = ENT_STATIC_THK_ctr + ENT_DYN_THK_ctr;
79   unsigned long tot_con_enters = ENT_STATIC_CON_ctr + ENT_DYN_CON_ctr;
80
81   unsigned long tot_fun_direct_enters = ENT_STATIC_FUN_DIRECT_ctr + ENT_DYN_FUN_DIRECT_ctr;
82   unsigned long tot_ind_enters = ENT_STATIC_IND_ctr + ENT_DYN_IND_ctr;
83   
84   // This is the number of times we entered a function via some kind
85   // of slow call.  It amounts to all the slow applications, not
86   // counting those that were to too few arguments.
87   /*
88   XXX This us unused - can we delete it? -- IGL 2008-04-25
89   unsigned long tot_fun_slow_enters = 
90       SLOW_CALL_ctr - 
91       SLOW_CALL_FUN_TOO_FEW_ctr -
92       SLOW_CALL_PAP_TOO_FEW_ctr;
93   */
94
95   unsigned long tot_known_calls =
96       KNOWN_CALL_ctr + KNOWN_CALL_TOO_FEW_ARGS_ctr + 
97       + KNOWN_CALL_EXTRA_ARGS_ctr;
98   unsigned long tot_tail_calls =
99       UNKNOWN_CALL_ctr + tot_known_calls;
100
101   unsigned long tot_enters = 
102       tot_con_enters + tot_fun_direct_enters +
103         tot_ind_enters + ENT_PERM_IND_ctr + ENT_PAP_ctr + tot_thk_enters;
104   unsigned long jump_direct_enters =
105         tot_enters - ENT_VIA_NODE_ctr;
106
107
108   unsigned long tot_returns =
109       RET_NEW_ctr + RET_OLD_ctr + RET_UNBOXED_TUP_ctr;
110
111   unsigned long tot_returns_of_new = RET_NEW_ctr;
112
113   unsigned long con_updates = UPD_CON_IN_NEW_ctr + UPD_CON_IN_PLACE_ctr;
114   unsigned long pap_updates = UPD_PAP_IN_NEW_ctr + UPD_PAP_IN_PLACE_ctr;
115
116   unsigned long tot_updates = UPD_SQUEEZED_ctr + pap_updates + con_updates;
117
118   unsigned long tot_new_updates   = UPD_NEW_IND_ctr + UPD_NEW_PERM_IND_ctr;
119   unsigned long tot_old_updates   = UPD_OLD_IND_ctr + UPD_OLD_PERM_IND_ctr;
120   unsigned long tot_gengc_updates = tot_new_updates + tot_old_updates;
121
122   FILE *tf = RtsFlags.TickyFlags.tickyFile;
123
124   /* If tf = NULL, that means the user passed in stderr for the ticky stats
125      file. According to a comment in RtsFlags.c, this means to use 
126      debugBelch to print out messages. But this function prints out a lot
127      of stuff so in order to avoid changing a lot of code, we just dump
128      the same output to stderr (for now). */
129   if( tf == NULL )
130     tf = stderr;
131
132   /* krc: avoid dealing with this just now */
133 #if FALSE
134   fprintf(tf,"\n\nALLOCATIONS: %ld (%ld words total: %ld admin, %ld goods, %ld slop)\n",
135           tot_allocs, tot_wds, tot_adm_wds, tot_gds_wds, tot_slp_wds);
136   fprintf(tf,"\t\t\t\ttotal words:\t    2     3     4     5    6+\n");
137
138 #define ALLOC_HISTO_MAGIC(categ) \
139         (PC(INTAVG(ALLOC_##categ##_hst[0], ALLOC_##categ##_ctr))), \
140         (PC(INTAVG(ALLOC_##categ##_hst[1], ALLOC_##categ##_ctr))), \
141         (PC(INTAVG(ALLOC_##categ##_hst[2], ALLOC_##categ##_ctr))), \
142         (PC(INTAVG(ALLOC_##categ##_hst[3], ALLOC_##categ##_ctr))), \
143         (PC(INTAVG(ALLOC_##categ##_hst[4], ALLOC_##categ##_ctr)))
144
145   fprintf(tf,"%7ld (%5.1f%%) function values",
146         ALLOC_FUN_ctr,
147         PC(INTAVG(ALLOC_FUN_ctr, tot_allocs)));
148   if (ALLOC_FUN_ctr != 0)
149       fprintf(tf,"\t\t%5.1f %5.1f %5.1f %5.1f %5.1f", ALLOC_HISTO_MAGIC(FUN));
150  
151
152   fprintf(tf,"\n%7ld (%5.1f%%) thunks",
153         ALLOC_SE_THK_ctr + ALLOC_UP_THK_ctr,
154         PC(INTAVG(ALLOC_SE_THK_ctr + ALLOC_UP_THK_ctr, tot_allocs)));
155
156 #define ALLOC_THK_ctr (ALLOC_UP_THK_ctr + ALLOC_SE_THK_ctr)
157   /* hack to make ALLOC_HISTO_MAGIC still work for THK */
158   if ((ALLOC_SE_THK_ctr + ALLOC_UP_THK_ctr) != 0)
159       fprintf(tf,"\t\t\t\t%5.1f %5.1f %5.1f %5.1f %5.1f", ALLOC_HISTO_MAGIC(THK));
160 #undef ALLOC_THK_ctr
161
162   fprintf(tf,"\n%7ld (%5.1f%%) data values",
163         ALLOC_CON_ctr,
164         PC(INTAVG(ALLOC_CON_ctr, tot_allocs)));
165   if (ALLOC_CON_ctr != 0)
166       fprintf(tf,"\t\t\t%5.1f %5.1f %5.1f %5.1f %5.1f", ALLOC_HISTO_MAGIC(CON));
167
168   fprintf(tf,"\n%7ld (%5.1f%%) big tuples",
169         ALLOC_TUP_ctr,
170         PC(INTAVG(ALLOC_TUP_ctr, tot_allocs)));
171   if (ALLOC_TUP_ctr != 0)
172       fprintf(tf,"\t\t\t%5.1f %5.1f %5.1f %5.1f %5.1f", ALLOC_HISTO_MAGIC(TUP));
173
174   fprintf(tf,"\n%7ld (%5.1f%%) black holes",
175         ALLOC_BH_ctr,
176         PC(INTAVG(ALLOC_BH_ctr, tot_allocs)));
177   if (ALLOC_BH_ctr != 0)
178       fprintf(tf,"\t\t\t%5.1f %5.1f %5.1f %5.1f %5.1f", ALLOC_HISTO_MAGIC(BH));
179
180   fprintf(tf,"\n%7ld (%5.1f%%) prim things",
181         ALLOC_PRIM_ctr,
182         PC(INTAVG(ALLOC_PRIM_ctr, tot_allocs)));
183   if (ALLOC_PRIM_ctr != 0)
184       fprintf(tf,"\t\t\t%5.1f %5.1f %5.1f %5.1f %5.1f", ALLOC_HISTO_MAGIC(PRIM));
185
186   fprintf(tf,"\n%7ld (%5.1f%%) partial applications",
187         ALLOC_PAP_ctr,
188         PC(INTAVG(ALLOC_PAP_ctr, tot_allocs)));
189   if (ALLOC_PAP_ctr != 0)
190       fprintf(tf,"\t\t%5.1f %5.1f %5.1f %5.1f %5.1f", ALLOC_HISTO_MAGIC(PAP));
191
192   fprintf(tf,"\n%7ld (%5.1f%%) thread state objects",
193         ALLOC_TSO_ctr,
194         PC(INTAVG(ALLOC_TSO_ctr, tot_allocs)));
195   if (ALLOC_TSO_ctr != 0)
196       fprintf(tf,"\t\t%5.1f %5.1f %5.1f %5.1f %5.1f", ALLOC_HISTO_MAGIC(TSO));
197
198   fprintf(tf,"\n");
199
200   fprintf(tf,"\nTotal storage-manager allocations: %ld (%ld words)\n\t[%ld words lost to speculative heap-checks]\n", ALLOC_HEAP_ctr, ALLOC_HEAP_tot, ALLOC_HEAP_tot - tot_wds);
201 #endif /* FALSE */
202
203
204   fprintf(tf,"\nSTACK USAGE:\n"); /* NB: some bits are direction sensitive */
205
206
207   fprintf(tf,"\nENTERS: %ld  of which %ld (%.1f%%) direct to the entry code\n\t\t  [the rest indirected via Node's info ptr]\n",
208         tot_enters,
209         jump_direct_enters,
210         PC(INTAVG(jump_direct_enters,tot_enters)));
211   fprintf(tf,"%7ld (%5.1f%%) thunks\n",
212         tot_thk_enters,
213         PC(INTAVG(tot_thk_enters,tot_enters)));
214   fprintf(tf,"%7ld (%5.1f%%) data values\n",
215         tot_con_enters,
216         PC(INTAVG(tot_con_enters,tot_enters)));
217   fprintf(tf,"%7ld (%5.1f%%) normal indirections\n",
218         tot_ind_enters,
219         PC(INTAVG(tot_ind_enters,tot_enters)));
220   fprintf(tf,"%7ld (%5.1f%%) permanent indirections\n",
221         ENT_PERM_IND_ctr,
222         PC(INTAVG(ENT_PERM_IND_ctr,tot_enters)));
223
224
225   fprintf(tf,"\nFUNCTION ENTRIES: %ld\n", tot_fun_direct_enters);
226
227   fprintf(tf, "\nTAIL CALLS: %ld, of which %ld (%.lf%%) were to known functions\n", 
228           tot_tail_calls, tot_known_calls,
229           PC(INTAVG(tot_known_calls,tot_tail_calls)));
230
231   fprintf(tf, "\nSLOW APPLICATIONS: %ld evaluated, %ld unevaluated\n",
232           SLOW_CALL_ctr, SLOW_CALL_UNEVALD_ctr);
233   fprintf(tf, "\n");
234   fprintf(tf, "         Too few args   Correct args   Too many args\n");
235   fprintf(tf, "   FUN     %8ld       %8ld        %8ld\n", 
236           SLOW_CALL_FUN_TOO_FEW_ctr, SLOW_CALL_FUN_CORRECT_ctr, SLOW_CALL_FUN_TOO_MANY_ctr);
237   fprintf(tf, "   PAP     %8ld       %8ld        %8ld\n", 
238           SLOW_CALL_PAP_TOO_FEW_ctr, SLOW_CALL_PAP_CORRECT_ctr, SLOW_CALL_PAP_TOO_MANY_ctr);
239   fprintf(tf, "\n");
240
241   fprintf(tf,"\nRETURNS: %ld\n", tot_returns);
242   fprintf(tf,"%7ld (%5.1f%%) from entering a new constructor\n\t\t  [the rest from entering an existing constructor]\n",
243         tot_returns_of_new,
244         PC(INTAVG(tot_returns_of_new,tot_returns)));
245
246   /* krc: comment out some of this stuff temporarily */
247
248   /*
249   fprintf(tf, "\nRET_NEW:         %7ld: ", RET_NEW_ctr);
250   for (i = 0; i < 9; i++) { fprintf(tf, "%5.1f%%",
251                                 PC(INTAVG(RET_NEW_hst[i],RET_NEW_ctr))); }
252   fprintf(tf, "\n");
253   fprintf(tf, "RET_OLD:         %7ld: ", RET_OLD_ctr);
254   for (i = 0; i < 9; i++) { fprintf(tf, "%5.1f%%",
255                                 PC(INTAVG(RET_OLD_hst[i],RET_OLD_ctr))); }
256   fprintf(tf, "\n");
257   fprintf(tf, "RET_UNBOXED_TUP: %7ld: ", RET_UNBOXED_TUP_ctr);
258   for (i = 0; i < 9; i++) { fprintf(tf, "%5.1f%%",
259                                     PC(INTAVG(RET_UNBOXED_TUP_hst[i],
260                                               RET_UNBOXED_TUP_ctr))); }
261   fprintf(tf, "\n");
262   */
263
264   fprintf(tf,"\nUPDATE FRAMES: %ld (%ld omitted from thunks)",
265         UPDF_PUSHED_ctr,
266         UPDF_OMITTED_ctr);
267
268   fprintf(tf,"\nCATCH FRAMES:  %ld", CATCHF_PUSHED_ctr);
269
270   if (UPDF_RCC_PUSHED_ctr != 0)
271      fprintf(tf,"%7ld restore cost centre frames (%ld omitted)\n",
272         UPDF_RCC_PUSHED_ctr,
273         UPDF_RCC_OMITTED_ctr);
274
275   fprintf(tf,"\nUPDATES: %ld\n", tot_updates);
276   fprintf(tf,"%7ld (%5.1f%%) data values\n\t\t  [%ld in place, %ld allocated new space]\n",
277         con_updates,
278         PC(INTAVG(con_updates,tot_updates)),
279         UPD_CON_IN_PLACE_ctr, UPD_CON_IN_NEW_ctr);
280   fprintf(tf,"%7ld (%5.1f%%) partial applications\n\t\t  [%ld in place, %ld allocated new space]\n",
281         pap_updates,
282         PC(INTAVG(pap_updates,tot_updates)),
283         UPD_PAP_IN_PLACE_ctr, UPD_PAP_IN_NEW_ctr);
284   fprintf(tf,"%7ld (%5.1f%%) updates by squeezing\n",
285         UPD_SQUEEZED_ctr,
286         PC(INTAVG(UPD_SQUEEZED_ctr, tot_updates)));
287
288   /* krc: also avoid dealing with this for now */
289 #if FALSE
290   fprintf(tf, "\nUPD_CON_IN_NEW:   %7ld: ", UPD_CON_IN_NEW_ctr);
291   for (i = 0; i < 9; i++) { fprintf(tf, "%7ld", UPD_CON_IN_NEW_hst[i]); }
292   fprintf(tf, "\n");
293   fprintf(tf, "UPD_CON_IN_PLACE: %7ld: ", UPD_CON_IN_PLACE_ctr);
294   for (i = 0; i < 9; i++) { fprintf(tf, "%7ld", UPD_CON_IN_PLACE_hst[i]); }
295   fprintf(tf, "\n");
296   fprintf(tf, "UPD_PAP_IN_NEW:   %7ld: ", UPD_PAP_IN_NEW_ctr);
297   for (i = 0; i < 9; i++) { fprintf(tf, "%7ld", UPD_PAP_IN_NEW_hst[i]); }
298   fprintf(tf, "\n");
299 #endif
300
301   if (tot_gengc_updates != 0) {
302       fprintf(tf,"\nNEW GEN UPDATES: %9ld (%5.1f%%)\n",
303               tot_new_updates,
304               PC(INTAVG(tot_new_updates,tot_gengc_updates)));
305       fprintf(tf,"OLD GEN UPDATES: %9ld (%5.1f%%)\n",
306               tot_old_updates,
307               PC(INTAVG(tot_old_updates,tot_gengc_updates)));
308   }
309
310   printRegisteredCounterInfo(tf);
311
312   fprintf(tf,"\n**************************************************\n");
313
314   /* here, we print out all the raw numbers; these are really
315     more useful when we want to snag them for subsequent
316     rdb-etc processing. WDP 95/11
317   */
318
319 #define PR_CTR(ctr) \
320   do { fprintf(tf,"%7ld " #ctr "\n", ctr); } while(0)
321 /* COND_PR_CTR takes a boolean; if false then msg is the printname rather than ctr */
322 #define COND_PR_CTR(ctr,b,msg) \
323     if (b) { fprintf(tf,"%7ld " #ctr "\n", ctr); } else { fprintf(tf,"%7ld " msg "\n", ctr); }
324 #define PR_HST(hst,i) \
325   do { fprintf(tf,"%7ld " #hst "_" #i "\n", hst[i]); } while(0)
326
327   PR_CTR(ALLOC_HEAP_ctr);
328   PR_CTR(ALLOC_HEAP_tot);
329
330   PR_CTR(ALLOC_FUN_ctr);
331   PR_CTR(ALLOC_FUN_adm);
332   PR_CTR(ALLOC_FUN_gds);
333   PR_CTR(ALLOC_FUN_slp);
334
335   /* krc: comment out some of this stuff temporarily
336   PR_HST(ALLOC_FUN_hst,0);
337   PR_HST(ALLOC_FUN_hst,1);
338   PR_HST(ALLOC_FUN_hst,2);
339   PR_HST(ALLOC_FUN_hst,3);
340   PR_HST(ALLOC_FUN_hst,4);
341   PR_CTR(ALLOC_UP_THK_ctr);
342   PR_CTR(ALLOC_SE_THK_ctr);
343   PR_CTR(ALLOC_THK_adm);
344   PR_CTR(ALLOC_THK_gds);
345   PR_CTR(ALLOC_THK_slp);
346   PR_HST(ALLOC_THK_hst,0);
347   PR_HST(ALLOC_THK_hst,1);
348   PR_HST(ALLOC_THK_hst,2);
349   PR_HST(ALLOC_THK_hst,3);
350   PR_HST(ALLOC_THK_hst,4);
351   PR_CTR(ALLOC_CON_ctr);
352   PR_CTR(ALLOC_CON_adm);
353   PR_CTR(ALLOC_CON_gds);
354   PR_CTR(ALLOC_CON_slp);
355   PR_HST(ALLOC_CON_hst,0);
356   PR_HST(ALLOC_CON_hst,1);
357   PR_HST(ALLOC_CON_hst,2);
358   PR_HST(ALLOC_CON_hst,3);
359   PR_HST(ALLOC_CON_hst,4);
360   PR_CTR(ALLOC_TUP_ctr);
361   PR_CTR(ALLOC_TUP_adm);
362   PR_CTR(ALLOC_TUP_gds);
363   PR_CTR(ALLOC_TUP_slp);
364   PR_HST(ALLOC_TUP_hst,0);
365   PR_HST(ALLOC_TUP_hst,1);
366   PR_HST(ALLOC_TUP_hst,2);
367   PR_HST(ALLOC_TUP_hst,3);
368   PR_HST(ALLOC_TUP_hst,4);
369   PR_CTR(ALLOC_BH_ctr);
370   PR_CTR(ALLOC_BH_adm);
371   PR_CTR(ALLOC_BH_gds);
372   PR_CTR(ALLOC_BH_slp);
373   PR_HST(ALLOC_BH_hst,0);
374   PR_HST(ALLOC_BH_hst,1);
375   PR_HST(ALLOC_BH_hst,2);
376   PR_HST(ALLOC_BH_hst,3);
377   PR_HST(ALLOC_BH_hst,4);
378   PR_CTR(ALLOC_PRIM_ctr);
379   PR_CTR(ALLOC_PRIM_adm);
380   PR_CTR(ALLOC_PRIM_gds);
381   PR_CTR(ALLOC_PRIM_slp);
382   PR_HST(ALLOC_PRIM_hst,0);
383   PR_HST(ALLOC_PRIM_hst,1);
384   PR_HST(ALLOC_PRIM_hst,2);
385   PR_HST(ALLOC_PRIM_hst,3);
386   PR_HST(ALLOC_PRIM_hst,4);
387   PR_CTR(ALLOC_PAP_ctr);
388   PR_CTR(ALLOC_PAP_adm);
389   PR_CTR(ALLOC_PAP_gds);
390   PR_CTR(ALLOC_PAP_slp);
391   PR_HST(ALLOC_PAP_hst,0);
392   PR_HST(ALLOC_PAP_hst,1);
393   PR_HST(ALLOC_PAP_hst,2);
394   PR_HST(ALLOC_PAP_hst,3);
395   PR_HST(ALLOC_PAP_hst,4);
396
397   PR_CTR(ALLOC_TSO_ctr);
398   PR_CTR(ALLOC_TSO_adm);
399   PR_CTR(ALLOC_TSO_gds);
400   PR_CTR(ALLOC_TSO_slp);
401   PR_HST(ALLOC_TSO_hst,0);
402   PR_HST(ALLOC_TSO_hst,1);
403   PR_HST(ALLOC_TSO_hst,2);
404   PR_HST(ALLOC_TSO_hst,3);
405   PR_HST(ALLOC_TSO_hst,4);
406   */
407
408   PR_CTR(ENT_VIA_NODE_ctr);
409   PR_CTR(ENT_STATIC_CON_ctr);
410   PR_CTR(ENT_DYN_CON_ctr);
411   PR_CTR(ENT_STATIC_FUN_DIRECT_ctr);
412   PR_CTR(ENT_DYN_FUN_DIRECT_ctr);
413   PR_CTR(ENT_STATIC_IND_ctr);
414   PR_CTR(ENT_DYN_IND_ctr);
415
416 /* The counters ENT_PERM_IND and UPD_{NEW,OLD}_PERM_IND are not dumped
417  * at the end of execution unless update squeezing is turned off (+RTS
418  * -Z =RtsFlags.GcFlags.squeezeUpdFrames), as they will be wrong
419  * otherwise.  Why?  Because for each update frame squeezed out, we
420  * count an UPD_NEW_PERM_IND *at GC time* (i.e., too early).  And
421  * further, when we enter the closure that has been updated, we count
422  * the ENT_PERM_IND, but we then enter the PERM_IND that was built for
423  * the next update frame below, and so on down the chain until we
424  * finally reach the value.  Thus we count many new ENT_PERM_INDs too
425  * early.  
426  * 
427  * This of course refers to the -ticky version that uses PERM_INDs to
428  * determine the number of closures entered 0/1/>1.  KSW 1999-04.  */
429   COND_PR_CTR(ENT_PERM_IND_ctr,RtsFlags.GcFlags.squeezeUpdFrames == rtsFalse,"E!NT_PERM_IND_ctr requires +RTS -Z");
430
431   PR_CTR(ENT_AP_ctr);
432   PR_CTR(ENT_PAP_ctr);
433   PR_CTR(ENT_AP_STACK_ctr);
434   PR_CTR(ENT_BH_ctr);
435   PR_CTR(ENT_STATIC_THK_ctr);
436   PR_CTR(ENT_DYN_THK_ctr);
437
438   PR_CTR(SLOW_CALL_v_ctr);
439   PR_CTR(SLOW_CALL_f_ctr);
440   PR_CTR(SLOW_CALL_d_ctr);
441   PR_CTR(SLOW_CALL_l_ctr);
442   PR_CTR(SLOW_CALL_n_ctr);
443   PR_CTR(SLOW_CALL_p_ctr);
444   PR_CTR(SLOW_CALL_pv_ctr);
445   PR_CTR(SLOW_CALL_pp_ctr);
446   PR_CTR(SLOW_CALL_ppv_ctr);
447   PR_CTR(SLOW_CALL_ppp_ctr);
448   PR_CTR(SLOW_CALL_pppv_ctr);
449   PR_CTR(SLOW_CALL_pppp_ctr);
450   PR_CTR(SLOW_CALL_ppppp_ctr);
451   PR_CTR(SLOW_CALL_pppppp_ctr);
452   PR_CTR(SLOW_CALL_OTHER_ctr);
453
454   PR_CTR(UNKNOWN_CALL_ctr);
455   PR_CTR(KNOWN_CALL_ctr);
456   PR_CTR(KNOWN_CALL_TOO_FEW_ARGS_ctr);
457   PR_CTR(KNOWN_CALL_EXTRA_ARGS_ctr);
458   PR_CTR(MULTI_CHUNK_SLOW_CALL_ctr);
459   PR_CTR(MULTI_CHUNK_SLOW_CALL_CHUNKS_ctr);
460   PR_CTR(SLOW_CALL_ctr);
461   PR_CTR(SLOW_CALL_FUN_TOO_FEW_ctr);
462   PR_CTR(SLOW_CALL_FUN_CORRECT_ctr);
463   PR_CTR(SLOW_CALL_FUN_TOO_MANY_ctr);
464   PR_CTR(SLOW_CALL_PAP_TOO_FEW_ctr);
465   PR_CTR(SLOW_CALL_PAP_CORRECT_ctr);
466   PR_CTR(SLOW_CALL_PAP_TOO_MANY_ctr);
467   PR_CTR(SLOW_CALL_UNEVALD_ctr);
468
469   /* krc: put off till later... */
470 #if FALSE
471   PR_HST(SLOW_CALL_hst,0);
472   PR_HST(SLOW_CALL_hst,1);
473   PR_HST(SLOW_CALL_hst,2);
474   PR_HST(SLOW_CALL_hst,3);
475   PR_HST(SLOW_CALL_hst,4);
476   PR_HST(SLOW_CALL_hst,5);
477   PR_HST(SLOW_CALL_hst,6);
478   PR_HST(SLOW_CALL_hst,7);
479 #endif
480
481   PR_CTR(RET_NEW_ctr);
482   PR_CTR(RET_OLD_ctr);
483   PR_CTR(RET_UNBOXED_TUP_ctr);
484
485   /* krc: put off till later... */
486 #if FALSE
487   PR_HST(RET_NEW_hst,0);
488   PR_HST(RET_NEW_hst,1);
489   PR_HST(RET_NEW_hst,2);
490   PR_HST(RET_NEW_hst,3);
491   PR_HST(RET_NEW_hst,4);
492   PR_HST(RET_NEW_hst,5);
493   PR_HST(RET_NEW_hst,6);
494   PR_HST(RET_NEW_hst,7);
495   PR_HST(RET_NEW_hst,8);
496   PR_HST(RET_OLD_hst,0);
497   PR_HST(RET_OLD_hst,1);
498   PR_HST(RET_OLD_hst,2);
499   PR_HST(RET_OLD_hst,3);
500   PR_HST(RET_OLD_hst,4);
501   PR_HST(RET_OLD_hst,5);
502   PR_HST(RET_OLD_hst,6);
503   PR_HST(RET_OLD_hst,7);
504   PR_HST(RET_OLD_hst,8);
505   PR_HST(RET_UNBOXED_TUP_hst,0);
506   PR_HST(RET_UNBOXED_TUP_hst,1);
507   PR_HST(RET_UNBOXED_TUP_hst,2);
508   PR_HST(RET_UNBOXED_TUP_hst,3);
509   PR_HST(RET_UNBOXED_TUP_hst,4);
510   PR_HST(RET_UNBOXED_TUP_hst,5);
511   PR_HST(RET_UNBOXED_TUP_hst,6);
512   PR_HST(RET_UNBOXED_TUP_hst,7);
513   PR_HST(RET_UNBOXED_TUP_hst,8);
514 #endif /* FALSE */
515
516   PR_CTR(UPDF_OMITTED_ctr);
517   PR_CTR(UPDF_PUSHED_ctr);
518   PR_CTR(CATCHF_PUSHED_ctr);
519
520   PR_CTR(UPDF_RCC_PUSHED_ctr);
521   PR_CTR(UPDF_RCC_OMITTED_ctr);
522
523   PR_CTR(UPD_SQUEEZED_ctr);
524   PR_CTR(UPD_CON_IN_NEW_ctr);
525   PR_CTR(UPD_CON_IN_PLACE_ctr);
526   PR_CTR(UPD_PAP_IN_NEW_ctr);
527   PR_CTR(UPD_PAP_IN_PLACE_ctr);
528
529   PR_CTR(UPD_BH_UPDATABLE_ctr);
530   PR_CTR(UPD_BH_SINGLE_ENTRY_ctr);
531   PR_CTR(UPD_CAF_BH_UPDATABLE_ctr);
532   PR_CTR(UPD_CAF_BH_SINGLE_ENTRY_ctr);
533
534   /* krc: put off till later...*/
535 #if FALSE
536   PR_HST(UPD_CON_IN_NEW_hst,0);
537   PR_HST(UPD_CON_IN_NEW_hst,1);
538   PR_HST(UPD_CON_IN_NEW_hst,2);
539   PR_HST(UPD_CON_IN_NEW_hst,3);
540   PR_HST(UPD_CON_IN_NEW_hst,4);
541   PR_HST(UPD_CON_IN_NEW_hst,5);
542   PR_HST(UPD_CON_IN_NEW_hst,6);
543   PR_HST(UPD_CON_IN_NEW_hst,7);
544   PR_HST(UPD_CON_IN_NEW_hst,8);
545   PR_HST(UPD_PAP_IN_NEW_hst,0);
546   PR_HST(UPD_PAP_IN_NEW_hst,1);
547   PR_HST(UPD_PAP_IN_NEW_hst,2);
548   PR_HST(UPD_PAP_IN_NEW_hst,3);
549   PR_HST(UPD_PAP_IN_NEW_hst,4);
550   PR_HST(UPD_PAP_IN_NEW_hst,5);
551   PR_HST(UPD_PAP_IN_NEW_hst,6);
552   PR_HST(UPD_PAP_IN_NEW_hst,7);
553   PR_HST(UPD_PAP_IN_NEW_hst,8);
554 #endif /* FALSE */
555
556   PR_CTR(UPD_NEW_IND_ctr);
557   /* see comment on ENT_PERM_IND_ctr */
558   COND_PR_CTR(UPD_NEW_PERM_IND_ctr,RtsFlags.GcFlags.squeezeUpdFrames == rtsFalse,"U!PD_NEW_PERM_IND_ctr requires +RTS -Z");
559   PR_CTR(UPD_OLD_IND_ctr);
560   /* see comment on ENT_PERM_IND_ctr */
561   COND_PR_CTR(UPD_OLD_PERM_IND_ctr,RtsFlags.GcFlags.squeezeUpdFrames == rtsFalse,"U!PD_OLD_PERM_IND_ctr requires +RTS -Z");
562
563   PR_CTR(GC_SEL_ABANDONED_ctr);
564   PR_CTR(GC_SEL_MINOR_ctr);
565   PR_CTR(GC_SEL_MAJOR_ctr);
566   PR_CTR(GC_FAILED_PROMOTION_ctr);
567 }
568
569 /* To print out all the registered-counter info: */
570
571 static void
572 printRegisteredCounterInfo (FILE *tf)
573 {
574     StgEntCounter *p;
575
576     if ( ticky_entry_ctrs != NULL ) {
577       fprintf(tf,"\n**************************************************\n\n");
578     }
579     fprintf(tf, "%11s%11s %6s%6s    %-11s%-30s\n",
580             "Entries", "Allocs", "Arity", "Stack", "Kinds", "Function");
581     fprintf(tf, "--------------------------------------------------------------------------------\n");
582     /* Function name at the end so it doesn't mess up the tabulation */
583
584     for (p = ticky_entry_ctrs; p != NULL; p = p->link) {
585         fprintf(tf, "%11ld%11ld %6lu%6lu    %-11s%-30s",
586                 p->entry_count,
587                 p->allocs,
588                 (unsigned long)p->arity,
589                 (unsigned long)p->stk_args,
590                 p->arg_kinds,
591                 p->str);
592
593         fprintf(tf, "\n");
594
595     }
596 }
597 #endif /* TICKY_TICKY */
598