1 /* -----------------------------------------------------------------------------
3 * (c) The AQUA project, Glasgow University, 1992-1997
4 * (c) The GHC Team, 1998-1999
6 * Ticky-ticky profiling
7 *-------------------------------------------------------------------------- */
9 #if defined(TICKY_TICKY)
11 #define TICKY_C /* define those variables */
12 #include "PosixSource.h"
14 #include "TickyCounters.h"
18 /* -----------------------------------------------------------------------------
19 Print out all the counters
20 -------------------------------------------------------------------------- */
22 static void printRegisteredCounterInfo (FILE *); /* fwd decl */
24 #define INTAVG(a,b) ((b == 0) ? 0.0 : ((double) (a) / (double) (b)))
25 #define PC(a) (100.0 * a)
28 StgDouble avg##thing = INTAVG(tot##thing,ctr##thing)
33 // XXX This is only used in commented out or #if FALSE'd out code currently:
36 /* XXX These are used only in an #if FALSE block below */
38 unsigned long tot_allocs = /* total number of things allocated */
39 ALLOC_FUN_ctr + ALLOC_SE_THK_ctr + ALLOC_UP_THK_ctr + ALLOC_CON_ctr + ALLOC_TUP_ctr +
40 + ALLOC_TSO_ctr + ALLOC_BH_ctr + ALLOC_PAP_ctr + ALLOC_PRIM_ctr
42 + ALLOC_FMBQ_ctr + ALLOC_FME_ctr + ALLOC_BF_ctr
46 unsigned long tot_adm_wds = /* total number of admin words allocated */
47 ALLOC_FUN_adm + ALLOC_THK_adm + ALLOC_CON_adm + ALLOC_TUP_adm
48 + ALLOC_TSO_adm + ALLOC_BH_adm + ALLOC_PAP_adm + ALLOC_PRIM_adm
50 + ALLOC_FMBQ_adm + ALLOC_FME_adm + ALLOC_BF_adm
54 unsigned long tot_gds_wds = /* total number of words of ``good stuff'' allocated */
55 ALLOC_FUN_gds + ALLOC_THK_gds + ALLOC_CON_gds + ALLOC_TUP_gds
56 + ALLOC_TSO_gds + ALLOC_BH_gds + ALLOC_PAP_gds + ALLOC_PRIM_gds
58 + ALLOC_FMBQ_gds + ALLOC_FME_gds + ALLOC_BF_gds
62 unsigned long tot_slp_wds = /* total number of ``slop'' words allocated */
63 ALLOC_FUN_slp + ALLOC_THK_slp + ALLOC_CON_slp + ALLOC_TUP_slp
64 + ALLOC_TSO_slp + ALLOC_BH_slp + ALLOC_PAP_slp + ALLOC_PRIM_slp
66 + ALLOC_FMBQ_slp + ALLOC_FME_slp + ALLOC_BF_slp
70 unsigned long tot_wds = /* total words */
71 tot_adm_wds + tot_gds_wds + tot_slp_wds;
74 unsigned long tot_thk_enters = ENT_STATIC_THK_ctr + ENT_DYN_THK_ctr;
75 unsigned long tot_con_enters = ENT_STATIC_CON_ctr + ENT_DYN_CON_ctr;
77 unsigned long tot_fun_direct_enters = ENT_STATIC_FUN_DIRECT_ctr + ENT_DYN_FUN_DIRECT_ctr;
78 unsigned long tot_ind_enters = ENT_STATIC_IND_ctr + ENT_DYN_IND_ctr;
80 // This is the number of times we entered a function via some kind
81 // of slow call. It amounts to all the slow applications, not
82 // counting those that were to too few arguments.
84 XXX This us unused - can we delete it? -- IGL 2008-04-25
85 unsigned long tot_fun_slow_enters =
87 SLOW_CALL_FUN_TOO_FEW_ctr -
88 SLOW_CALL_PAP_TOO_FEW_ctr;
91 unsigned long tot_known_calls =
92 KNOWN_CALL_ctr + KNOWN_CALL_TOO_FEW_ARGS_ctr +
93 + KNOWN_CALL_EXTRA_ARGS_ctr;
94 unsigned long tot_tail_calls =
95 UNKNOWN_CALL_ctr + tot_known_calls;
97 unsigned long tot_enters =
98 tot_con_enters + tot_fun_direct_enters +
99 tot_ind_enters + ENT_PERM_IND_ctr + ENT_PAP_ctr + tot_thk_enters;
100 unsigned long jump_direct_enters =
101 tot_enters - ENT_VIA_NODE_ctr;
104 unsigned long tot_returns =
105 RET_NEW_ctr + RET_OLD_ctr + RET_UNBOXED_TUP_ctr;
107 unsigned long tot_returns_of_new = RET_NEW_ctr;
109 unsigned long con_updates = UPD_CON_IN_NEW_ctr + UPD_CON_IN_PLACE_ctr;
110 unsigned long pap_updates = UPD_PAP_IN_NEW_ctr + UPD_PAP_IN_PLACE_ctr;
112 unsigned long tot_updates = UPD_SQUEEZED_ctr + pap_updates + con_updates;
114 unsigned long tot_new_updates = UPD_NEW_IND_ctr + UPD_NEW_PERM_IND_ctr;
115 unsigned long tot_old_updates = UPD_OLD_IND_ctr + UPD_OLD_PERM_IND_ctr;
116 unsigned long tot_gengc_updates = tot_new_updates + tot_old_updates;
118 FILE *tf = RtsFlags.TickyFlags.tickyFile;
120 /* If tf = NULL, that means the user passed in stderr for the ticky stats
121 file. According to a comment in RtsFlags.c, this means to use
122 debugBelch to print out messages. But this function prints out a lot
123 of stuff so in order to avoid changing a lot of code, we just dump
124 the same output to stderr (for now). */
128 /* krc: avoid dealing with this just now */
130 fprintf(tf,"\n\nALLOCATIONS: %ld (%ld words total: %ld admin, %ld goods, %ld slop)\n",
131 tot_allocs, tot_wds, tot_adm_wds, tot_gds_wds, tot_slp_wds);
132 fprintf(tf,"\t\t\t\ttotal words:\t 2 3 4 5 6+\n");
134 #define ALLOC_HISTO_MAGIC(categ) \
135 (PC(INTAVG(ALLOC_##categ##_hst[0], ALLOC_##categ##_ctr))), \
136 (PC(INTAVG(ALLOC_##categ##_hst[1], ALLOC_##categ##_ctr))), \
137 (PC(INTAVG(ALLOC_##categ##_hst[2], ALLOC_##categ##_ctr))), \
138 (PC(INTAVG(ALLOC_##categ##_hst[3], ALLOC_##categ##_ctr))), \
139 (PC(INTAVG(ALLOC_##categ##_hst[4], ALLOC_##categ##_ctr)))
141 fprintf(tf,"%7ld (%5.1f%%) function values",
143 PC(INTAVG(ALLOC_FUN_ctr, tot_allocs)));
144 if (ALLOC_FUN_ctr != 0)
145 fprintf(tf,"\t\t%5.1f %5.1f %5.1f %5.1f %5.1f", ALLOC_HISTO_MAGIC(FUN));
148 fprintf(tf,"\n%7ld (%5.1f%%) thunks",
149 ALLOC_SE_THK_ctr + ALLOC_UP_THK_ctr,
150 PC(INTAVG(ALLOC_SE_THK_ctr + ALLOC_UP_THK_ctr, tot_allocs)));
152 #define ALLOC_THK_ctr (ALLOC_UP_THK_ctr + ALLOC_SE_THK_ctr)
153 /* hack to make ALLOC_HISTO_MAGIC still work for THK */
154 if ((ALLOC_SE_THK_ctr + ALLOC_UP_THK_ctr) != 0)
155 fprintf(tf,"\t\t\t\t%5.1f %5.1f %5.1f %5.1f %5.1f", ALLOC_HISTO_MAGIC(THK));
158 fprintf(tf,"\n%7ld (%5.1f%%) data values",
160 PC(INTAVG(ALLOC_CON_ctr, tot_allocs)));
161 if (ALLOC_CON_ctr != 0)
162 fprintf(tf,"\t\t\t%5.1f %5.1f %5.1f %5.1f %5.1f", ALLOC_HISTO_MAGIC(CON));
164 fprintf(tf,"\n%7ld (%5.1f%%) big tuples",
166 PC(INTAVG(ALLOC_TUP_ctr, tot_allocs)));
167 if (ALLOC_TUP_ctr != 0)
168 fprintf(tf,"\t\t\t%5.1f %5.1f %5.1f %5.1f %5.1f", ALLOC_HISTO_MAGIC(TUP));
170 fprintf(tf,"\n%7ld (%5.1f%%) black holes",
172 PC(INTAVG(ALLOC_BH_ctr, tot_allocs)));
173 if (ALLOC_BH_ctr != 0)
174 fprintf(tf,"\t\t\t%5.1f %5.1f %5.1f %5.1f %5.1f", ALLOC_HISTO_MAGIC(BH));
176 fprintf(tf,"\n%7ld (%5.1f%%) prim things",
178 PC(INTAVG(ALLOC_PRIM_ctr, tot_allocs)));
179 if (ALLOC_PRIM_ctr != 0)
180 fprintf(tf,"\t\t\t%5.1f %5.1f %5.1f %5.1f %5.1f", ALLOC_HISTO_MAGIC(PRIM));
182 fprintf(tf,"\n%7ld (%5.1f%%) partial applications",
184 PC(INTAVG(ALLOC_PAP_ctr, tot_allocs)));
185 if (ALLOC_PAP_ctr != 0)
186 fprintf(tf,"\t\t%5.1f %5.1f %5.1f %5.1f %5.1f", ALLOC_HISTO_MAGIC(PAP));
188 fprintf(tf,"\n%7ld (%5.1f%%) thread state objects",
190 PC(INTAVG(ALLOC_TSO_ctr, tot_allocs)));
191 if (ALLOC_TSO_ctr != 0)
192 fprintf(tf,"\t\t%5.1f %5.1f %5.1f %5.1f %5.1f", ALLOC_HISTO_MAGIC(TSO));
194 fprintf(tf,"\n%7ld (%5.1f%%) thread state objects",
196 PC(INTAVG(ALLOC_FMBQ_ctr, tot_allocs)));
197 if (ALLOC_FMBQ_ctr != 0)
198 fprintf(tf,"\t\t%5.1f %5.1f %5.1f %5.1f %5.1f", ALLOC_HISTO_MAGIC(FMBQ));
199 fprintf(tf,"\n%7ld (%5.1f%%) thread state objects",
201 PC(INTAVG(ALLOC_FME_ctr, tot_allocs)));
202 if (ALLOC_FME_ctr != 0)
203 fprintf(tf,"\t\t%5.1f %5.1f %5.1f %5.1f %5.1f", ALLOC_HISTO_MAGIC(FME));
204 fprintf(tf,"\n%7ld (%5.1f%%) thread state objects",
206 PC(INTAVG(ALLOC_BF_ctr, tot_allocs)));
207 if (ALLOC_BF_ctr != 0)
208 fprintf(tf,"\t\t%5.1f %5.1f %5.1f %5.1f %5.1f", ALLOC_HISTO_MAGIC(BF));
213 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);
217 fprintf(tf,"\nSTACK USAGE:\n"); /* NB: some bits are direction sensitive */
220 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",
223 PC(INTAVG(jump_direct_enters,tot_enters)));
224 fprintf(tf,"%7ld (%5.1f%%) thunks\n",
226 PC(INTAVG(tot_thk_enters,tot_enters)));
227 fprintf(tf,"%7ld (%5.1f%%) data values\n",
229 PC(INTAVG(tot_con_enters,tot_enters)));
230 fprintf(tf,"%7ld (%5.1f%%) normal indirections\n",
232 PC(INTAVG(tot_ind_enters,tot_enters)));
233 fprintf(tf,"%7ld (%5.1f%%) permanent indirections\n",
235 PC(INTAVG(ENT_PERM_IND_ctr,tot_enters)));
238 fprintf(tf,"\nFUNCTION ENTRIES: %ld\n", tot_fun_direct_enters);
240 fprintf(tf, "\nTAIL CALLS: %ld, of which %ld (%.lf%%) were to known functions\n",
241 tot_tail_calls, tot_known_calls,
242 PC(INTAVG(tot_known_calls,tot_tail_calls)));
244 fprintf(tf, "\nSLOW APPLICATIONS: %ld evaluated, %ld unevaluated\n",
245 SLOW_CALL_ctr, SLOW_CALL_UNEVALD_ctr);
247 fprintf(tf, " Too few args Correct args Too many args\n");
248 fprintf(tf, " FUN %8ld %8ld %8ld\n",
249 SLOW_CALL_FUN_TOO_FEW_ctr, SLOW_CALL_FUN_CORRECT_ctr, SLOW_CALL_FUN_TOO_MANY_ctr);
250 fprintf(tf, " PAP %8ld %8ld %8ld\n",
251 SLOW_CALL_PAP_TOO_FEW_ctr, SLOW_CALL_PAP_CORRECT_ctr, SLOW_CALL_PAP_TOO_MANY_ctr);
254 fprintf(tf,"\nRETURNS: %ld\n", tot_returns);
255 fprintf(tf,"%7ld (%5.1f%%) from entering a new constructor\n\t\t [the rest from entering an existing constructor]\n",
257 PC(INTAVG(tot_returns_of_new,tot_returns)));
259 /* krc: comment out some of this stuff temporarily */
262 fprintf(tf, "\nRET_NEW: %7ld: ", RET_NEW_ctr);
263 for (i = 0; i < 9; i++) { fprintf(tf, "%5.1f%%",
264 PC(INTAVG(RET_NEW_hst[i],RET_NEW_ctr))); }
266 fprintf(tf, "RET_OLD: %7ld: ", RET_OLD_ctr);
267 for (i = 0; i < 9; i++) { fprintf(tf, "%5.1f%%",
268 PC(INTAVG(RET_OLD_hst[i],RET_OLD_ctr))); }
270 fprintf(tf, "RET_UNBOXED_TUP: %7ld: ", RET_UNBOXED_TUP_ctr);
271 for (i = 0; i < 9; i++) { fprintf(tf, "%5.1f%%",
272 PC(INTAVG(RET_UNBOXED_TUP_hst[i],
273 RET_UNBOXED_TUP_ctr))); }
277 fprintf(tf,"\nUPDATE FRAMES: %ld (%ld omitted from thunks)",
281 fprintf(tf,"\nCATCH FRAMES: %ld", CATCHF_PUSHED_ctr);
283 if (UPDF_RCC_PUSHED_ctr != 0)
284 fprintf(tf,"%7ld restore cost centre frames (%ld omitted)\n",
286 UPDF_RCC_OMITTED_ctr);
288 fprintf(tf,"\nUPDATES: %ld\n", tot_updates);
289 fprintf(tf,"%7ld (%5.1f%%) data values\n\t\t [%ld in place, %ld allocated new space]\n",
291 PC(INTAVG(con_updates,tot_updates)),
292 UPD_CON_IN_PLACE_ctr, UPD_CON_IN_NEW_ctr);
293 fprintf(tf,"%7ld (%5.1f%%) partial applications\n\t\t [%ld in place, %ld allocated new space]\n",
295 PC(INTAVG(pap_updates,tot_updates)),
296 UPD_PAP_IN_PLACE_ctr, UPD_PAP_IN_NEW_ctr);
297 fprintf(tf,"%7ld (%5.1f%%) updates by squeezing\n",
299 PC(INTAVG(UPD_SQUEEZED_ctr, tot_updates)));
301 /* krc: also avoid dealing with this for now */
303 fprintf(tf, "\nUPD_CON_IN_NEW: %7ld: ", UPD_CON_IN_NEW_ctr);
304 for (i = 0; i < 9; i++) { fprintf(tf, "%7ld", UPD_CON_IN_NEW_hst[i]); }
306 fprintf(tf, "UPD_CON_IN_PLACE: %7ld: ", UPD_CON_IN_PLACE_ctr);
307 for (i = 0; i < 9; i++) { fprintf(tf, "%7ld", UPD_CON_IN_PLACE_hst[i]); }
309 fprintf(tf, "UPD_PAP_IN_NEW: %7ld: ", UPD_PAP_IN_NEW_ctr);
310 for (i = 0; i < 9; i++) { fprintf(tf, "%7ld", UPD_PAP_IN_NEW_hst[i]); }
314 if (tot_gengc_updates != 0) {
315 fprintf(tf,"\nNEW GEN UPDATES: %9ld (%5.1f%%)\n",
317 PC(INTAVG(tot_new_updates,tot_gengc_updates)));
318 fprintf(tf,"OLD GEN UPDATES: %9ld (%5.1f%%)\n",
320 PC(INTAVG(tot_old_updates,tot_gengc_updates)));
323 fprintf(tf,"\nTotal bytes copied during GC: %ld\n",
324 GC_WORDS_COPIED_ctr * sizeof(W_));
326 printRegisteredCounterInfo(tf);
328 fprintf(tf,"\n**************************************************\n");
330 /* here, we print out all the raw numbers; these are really
331 more useful when we want to snag them for subsequent
332 rdb-etc processing. WDP 95/11
335 #define PR_CTR(ctr) \
336 do { fprintf(tf,"%7ld " #ctr "\n", ctr); } while(0)
337 /* COND_PR_CTR takes a boolean; if false then msg is the printname rather than ctr */
338 #define COND_PR_CTR(ctr,b,msg) \
339 if (b) { fprintf(tf,"%7ld " #ctr "\n", ctr); } else { fprintf(tf,"%7ld " msg "\n", ctr); }
340 #define PR_HST(hst,i) \
341 do { fprintf(tf,"%7ld " #hst "_" #i "\n", hst[i]); } while(0)
343 PR_CTR(ALLOC_HEAP_ctr);
344 PR_CTR(ALLOC_HEAP_tot);
346 PR_CTR(ALLOC_FUN_ctr);
347 PR_CTR(ALLOC_FUN_adm);
348 PR_CTR(ALLOC_FUN_gds);
349 PR_CTR(ALLOC_FUN_slp);
351 /* krc: comment out some of this stuff temporarily
352 PR_HST(ALLOC_FUN_hst,0);
353 PR_HST(ALLOC_FUN_hst,1);
354 PR_HST(ALLOC_FUN_hst,2);
355 PR_HST(ALLOC_FUN_hst,3);
356 PR_HST(ALLOC_FUN_hst,4);
357 PR_CTR(ALLOC_UP_THK_ctr);
358 PR_CTR(ALLOC_SE_THK_ctr);
359 PR_CTR(ALLOC_THK_adm);
360 PR_CTR(ALLOC_THK_gds);
361 PR_CTR(ALLOC_THK_slp);
362 PR_HST(ALLOC_THK_hst,0);
363 PR_HST(ALLOC_THK_hst,1);
364 PR_HST(ALLOC_THK_hst,2);
365 PR_HST(ALLOC_THK_hst,3);
366 PR_HST(ALLOC_THK_hst,4);
367 PR_CTR(ALLOC_CON_ctr);
368 PR_CTR(ALLOC_CON_adm);
369 PR_CTR(ALLOC_CON_gds);
370 PR_CTR(ALLOC_CON_slp);
371 PR_HST(ALLOC_CON_hst,0);
372 PR_HST(ALLOC_CON_hst,1);
373 PR_HST(ALLOC_CON_hst,2);
374 PR_HST(ALLOC_CON_hst,3);
375 PR_HST(ALLOC_CON_hst,4);
376 PR_CTR(ALLOC_TUP_ctr);
377 PR_CTR(ALLOC_TUP_adm);
378 PR_CTR(ALLOC_TUP_gds);
379 PR_CTR(ALLOC_TUP_slp);
380 PR_HST(ALLOC_TUP_hst,0);
381 PR_HST(ALLOC_TUP_hst,1);
382 PR_HST(ALLOC_TUP_hst,2);
383 PR_HST(ALLOC_TUP_hst,3);
384 PR_HST(ALLOC_TUP_hst,4);
385 PR_CTR(ALLOC_BH_ctr);
386 PR_CTR(ALLOC_BH_adm);
387 PR_CTR(ALLOC_BH_gds);
388 PR_CTR(ALLOC_BH_slp);
389 PR_HST(ALLOC_BH_hst,0);
390 PR_HST(ALLOC_BH_hst,1);
391 PR_HST(ALLOC_BH_hst,2);
392 PR_HST(ALLOC_BH_hst,3);
393 PR_HST(ALLOC_BH_hst,4);
394 PR_CTR(ALLOC_PRIM_ctr);
395 PR_CTR(ALLOC_PRIM_adm);
396 PR_CTR(ALLOC_PRIM_gds);
397 PR_CTR(ALLOC_PRIM_slp);
398 PR_HST(ALLOC_PRIM_hst,0);
399 PR_HST(ALLOC_PRIM_hst,1);
400 PR_HST(ALLOC_PRIM_hst,2);
401 PR_HST(ALLOC_PRIM_hst,3);
402 PR_HST(ALLOC_PRIM_hst,4);
403 PR_CTR(ALLOC_PAP_ctr);
404 PR_CTR(ALLOC_PAP_adm);
405 PR_CTR(ALLOC_PAP_gds);
406 PR_CTR(ALLOC_PAP_slp);
407 PR_HST(ALLOC_PAP_hst,0);
408 PR_HST(ALLOC_PAP_hst,1);
409 PR_HST(ALLOC_PAP_hst,2);
410 PR_HST(ALLOC_PAP_hst,3);
411 PR_HST(ALLOC_PAP_hst,4);
413 PR_CTR(ALLOC_TSO_ctr);
414 PR_CTR(ALLOC_TSO_adm);
415 PR_CTR(ALLOC_TSO_gds);
416 PR_CTR(ALLOC_TSO_slp);
417 PR_HST(ALLOC_TSO_hst,0);
418 PR_HST(ALLOC_TSO_hst,1);
419 PR_HST(ALLOC_TSO_hst,2);
420 PR_HST(ALLOC_TSO_hst,3);
421 PR_HST(ALLOC_TSO_hst,4);
424 PR_CTR(ALLOC_FMBQ_ctr);
425 PR_CTR(ALLOC_FMBQ_adm);
426 PR_CTR(ALLOC_FMBQ_gds);
427 PR_CTR(ALLOC_FMBQ_slp);
428 PR_HST(ALLOC_FMBQ_hst,0);
429 PR_HST(ALLOC_FMBQ_hst,1);
430 PR_HST(ALLOC_FMBQ_hst,2);
431 PR_HST(ALLOC_FMBQ_hst,3);
432 PR_HST(ALLOC_FMBQ_hst,4);
433 PR_CTR(ALLOC_FME_ctr);
434 PR_CTR(ALLOC_FME_adm);
435 PR_CTR(ALLOC_FME_gds);
436 PR_CTR(ALLOC_FME_slp);
437 PR_HST(ALLOC_FME_hst,0);
438 PR_HST(ALLOC_FME_hst,1);
439 PR_HST(ALLOC_FME_hst,2);
440 PR_HST(ALLOC_FME_hst,3);
441 PR_HST(ALLOC_FME_hst,4);
442 PR_CTR(ALLOC_BF_ctr);
443 PR_CTR(ALLOC_BF_adm);
444 PR_CTR(ALLOC_BF_gds);
445 PR_CTR(ALLOC_BF_slp);
446 PR_HST(ALLOC_BF_hst,0);
447 PR_HST(ALLOC_BF_hst,1);
448 PR_HST(ALLOC_BF_hst,2);
449 PR_HST(ALLOC_BF_hst,3);
450 PR_HST(ALLOC_BF_hst,4);
454 PR_CTR(ENT_VIA_NODE_ctr);
455 PR_CTR(ENT_STATIC_CON_ctr);
456 PR_CTR(ENT_DYN_CON_ctr);
457 PR_CTR(ENT_STATIC_FUN_DIRECT_ctr);
458 PR_CTR(ENT_DYN_FUN_DIRECT_ctr);
459 PR_CTR(ENT_STATIC_IND_ctr);
460 PR_CTR(ENT_DYN_IND_ctr);
462 /* The counters ENT_PERM_IND and UPD_{NEW,OLD}_PERM_IND are not dumped
463 * at the end of execution unless update squeezing is turned off (+RTS
464 * -Z =RtsFlags.GcFlags.squeezeUpdFrames), as they will be wrong
465 * otherwise. Why? Because for each update frame squeezed out, we
466 * count an UPD_NEW_PERM_IND *at GC time* (i.e., too early). And
467 * further, when we enter the closure that has been updated, we count
468 * the ENT_PERM_IND, but we then enter the PERM_IND that was built for
469 * the next update frame below, and so on down the chain until we
470 * finally reach the value. Thus we count many new ENT_PERM_INDs too
473 * This of course refers to the -ticky version that uses PERM_INDs to
474 * determine the number of closures entered 0/1/>1. KSW 1999-04. */
475 COND_PR_CTR(ENT_PERM_IND_ctr,RtsFlags.GcFlags.squeezeUpdFrames == rtsFalse,"E!NT_PERM_IND_ctr requires +RTS -Z");
479 PR_CTR(ENT_AP_STACK_ctr);
481 PR_CTR(ENT_STATIC_THK_ctr);
482 PR_CTR(ENT_DYN_THK_ctr);
484 PR_CTR(SLOW_CALL_v_ctr);
485 PR_CTR(SLOW_CALL_f_ctr);
486 PR_CTR(SLOW_CALL_d_ctr);
487 PR_CTR(SLOW_CALL_l_ctr);
488 PR_CTR(SLOW_CALL_n_ctr);
489 PR_CTR(SLOW_CALL_p_ctr);
490 PR_CTR(SLOW_CALL_pv_ctr);
491 PR_CTR(SLOW_CALL_pp_ctr);
492 PR_CTR(SLOW_CALL_ppv_ctr);
493 PR_CTR(SLOW_CALL_ppp_ctr);
494 PR_CTR(SLOW_CALL_pppv_ctr);
495 PR_CTR(SLOW_CALL_pppp_ctr);
496 PR_CTR(SLOW_CALL_ppppp_ctr);
497 PR_CTR(SLOW_CALL_pppppp_ctr);
498 PR_CTR(SLOW_CALL_OTHER_ctr);
500 PR_CTR(UNKNOWN_CALL_ctr);
501 PR_CTR(KNOWN_CALL_ctr);
502 PR_CTR(KNOWN_CALL_TOO_FEW_ARGS_ctr);
503 PR_CTR(KNOWN_CALL_EXTRA_ARGS_ctr);
504 PR_CTR(MULTI_CHUNK_SLOW_CALL_ctr);
505 PR_CTR(MULTI_CHUNK_SLOW_CALL_CHUNKS_ctr);
506 PR_CTR(SLOW_CALL_ctr);
507 PR_CTR(SLOW_CALL_FUN_TOO_FEW_ctr);
508 PR_CTR(SLOW_CALL_FUN_CORRECT_ctr);
509 PR_CTR(SLOW_CALL_FUN_TOO_MANY_ctr);
510 PR_CTR(SLOW_CALL_PAP_TOO_FEW_ctr);
511 PR_CTR(SLOW_CALL_PAP_CORRECT_ctr);
512 PR_CTR(SLOW_CALL_PAP_TOO_MANY_ctr);
513 PR_CTR(SLOW_CALL_UNEVALD_ctr);
515 /* krc: put off till later... */
517 PR_HST(SLOW_CALL_hst,0);
518 PR_HST(SLOW_CALL_hst,1);
519 PR_HST(SLOW_CALL_hst,2);
520 PR_HST(SLOW_CALL_hst,3);
521 PR_HST(SLOW_CALL_hst,4);
522 PR_HST(SLOW_CALL_hst,5);
523 PR_HST(SLOW_CALL_hst,6);
524 PR_HST(SLOW_CALL_hst,7);
529 PR_CTR(RET_UNBOXED_TUP_ctr);
531 /* krc: put off till later... */
533 PR_HST(RET_NEW_hst,0);
534 PR_HST(RET_NEW_hst,1);
535 PR_HST(RET_NEW_hst,2);
536 PR_HST(RET_NEW_hst,3);
537 PR_HST(RET_NEW_hst,4);
538 PR_HST(RET_NEW_hst,5);
539 PR_HST(RET_NEW_hst,6);
540 PR_HST(RET_NEW_hst,7);
541 PR_HST(RET_NEW_hst,8);
542 PR_HST(RET_OLD_hst,0);
543 PR_HST(RET_OLD_hst,1);
544 PR_HST(RET_OLD_hst,2);
545 PR_HST(RET_OLD_hst,3);
546 PR_HST(RET_OLD_hst,4);
547 PR_HST(RET_OLD_hst,5);
548 PR_HST(RET_OLD_hst,6);
549 PR_HST(RET_OLD_hst,7);
550 PR_HST(RET_OLD_hst,8);
551 PR_HST(RET_UNBOXED_TUP_hst,0);
552 PR_HST(RET_UNBOXED_TUP_hst,1);
553 PR_HST(RET_UNBOXED_TUP_hst,2);
554 PR_HST(RET_UNBOXED_TUP_hst,3);
555 PR_HST(RET_UNBOXED_TUP_hst,4);
556 PR_HST(RET_UNBOXED_TUP_hst,5);
557 PR_HST(RET_UNBOXED_TUP_hst,6);
558 PR_HST(RET_UNBOXED_TUP_hst,7);
559 PR_HST(RET_UNBOXED_TUP_hst,8);
562 PR_CTR(UPDF_OMITTED_ctr);
563 PR_CTR(UPDF_PUSHED_ctr);
564 PR_CTR(CATCHF_PUSHED_ctr);
566 PR_CTR(UPDF_RCC_PUSHED_ctr);
567 PR_CTR(UPDF_RCC_OMITTED_ctr);
569 PR_CTR(UPD_SQUEEZED_ctr);
570 PR_CTR(UPD_CON_IN_NEW_ctr);
571 PR_CTR(UPD_CON_IN_PLACE_ctr);
572 PR_CTR(UPD_PAP_IN_NEW_ctr);
573 PR_CTR(UPD_PAP_IN_PLACE_ctr);
575 PR_CTR(UPD_BH_UPDATABLE_ctr);
576 PR_CTR(UPD_BH_SINGLE_ENTRY_ctr);
577 PR_CTR(UPD_CAF_BH_UPDATABLE_ctr);
578 PR_CTR(UPD_CAF_BH_SINGLE_ENTRY_ctr);
580 /* krc: put off till later...*/
582 PR_HST(UPD_CON_IN_NEW_hst,0);
583 PR_HST(UPD_CON_IN_NEW_hst,1);
584 PR_HST(UPD_CON_IN_NEW_hst,2);
585 PR_HST(UPD_CON_IN_NEW_hst,3);
586 PR_HST(UPD_CON_IN_NEW_hst,4);
587 PR_HST(UPD_CON_IN_NEW_hst,5);
588 PR_HST(UPD_CON_IN_NEW_hst,6);
589 PR_HST(UPD_CON_IN_NEW_hst,7);
590 PR_HST(UPD_CON_IN_NEW_hst,8);
591 PR_HST(UPD_PAP_IN_NEW_hst,0);
592 PR_HST(UPD_PAP_IN_NEW_hst,1);
593 PR_HST(UPD_PAP_IN_NEW_hst,2);
594 PR_HST(UPD_PAP_IN_NEW_hst,3);
595 PR_HST(UPD_PAP_IN_NEW_hst,4);
596 PR_HST(UPD_PAP_IN_NEW_hst,5);
597 PR_HST(UPD_PAP_IN_NEW_hst,6);
598 PR_HST(UPD_PAP_IN_NEW_hst,7);
599 PR_HST(UPD_PAP_IN_NEW_hst,8);
602 PR_CTR(UPD_NEW_IND_ctr);
603 /* see comment on ENT_PERM_IND_ctr */
604 COND_PR_CTR(UPD_NEW_PERM_IND_ctr,RtsFlags.GcFlags.squeezeUpdFrames == rtsFalse,"U!PD_NEW_PERM_IND_ctr requires +RTS -Z");
605 PR_CTR(UPD_OLD_IND_ctr);
606 /* see comment on ENT_PERM_IND_ctr */
607 COND_PR_CTR(UPD_OLD_PERM_IND_ctr,RtsFlags.GcFlags.squeezeUpdFrames == rtsFalse,"U!PD_OLD_PERM_IND_ctr requires +RTS -Z");
609 PR_CTR(GC_SEL_ABANDONED_ctr);
610 PR_CTR(GC_SEL_MINOR_ctr);
611 PR_CTR(GC_SEL_MAJOR_ctr);
612 PR_CTR(GC_FAILED_PROMOTION_ctr);
613 PR_CTR(GC_WORDS_COPIED_ctr);
616 /* Data structure used in ``registering'' one of these counters. */
618 StgEntCounter *ticky_entry_ctrs = NULL; /* root of list of them */
620 /* To print out all the registered-counter info: */
623 printRegisteredCounterInfo (FILE *tf)
627 if ( ticky_entry_ctrs != NULL ) {
628 fprintf(tf,"\n**************************************************\n\n");
630 fprintf(tf, "%11s%11s %6s%6s %-11s%-30s\n",
631 "Entries", "Allocs", "Arity", "Stack", "Kinds", "Function");
632 fprintf(tf, "--------------------------------------------------------------------------------\n");
633 /* Function name at the end so it doesn't mess up the tabulation */
635 for (p = ticky_entry_ctrs; p != NULL; p = p->link) {
636 fprintf(tf, "%11ld%11ld %6zu%6zu %-11s%-30s",
649 /* Catch-all top-level counter struct. Allocations from CAFs will go
657 #endif /* TICKY_TICKY */