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)
35 unsigned long tot_allocs = /* total number of things allocated */
36 ALLOC_FUN_ctr + ALLOC_SE_THK_ctr + ALLOC_UP_THK_ctr + ALLOC_CON_ctr + ALLOC_TUP_ctr +
37 + ALLOC_TSO_ctr + ALLOC_BH_ctr + ALLOC_PAP_ctr + ALLOC_PRIM_ctr
39 + ALLOC_FMBQ_ctr + ALLOC_FME_ctr + ALLOC_BF_ctr
43 unsigned long tot_adm_wds = /* total number of admin words allocated */
44 ALLOC_FUN_adm + ALLOC_THK_adm + ALLOC_CON_adm + ALLOC_TUP_adm
45 + ALLOC_TSO_adm + ALLOC_BH_adm + ALLOC_PAP_adm + ALLOC_PRIM_adm
47 + ALLOC_FMBQ_adm + ALLOC_FME_adm + ALLOC_BF_adm
51 unsigned long tot_gds_wds = /* total number of words of ``good stuff'' allocated */
52 ALLOC_FUN_gds + ALLOC_THK_gds + ALLOC_CON_gds + ALLOC_TUP_gds
53 + ALLOC_TSO_gds + ALLOC_BH_gds + ALLOC_PAP_gds + ALLOC_PRIM_gds
55 + ALLOC_FMBQ_gds + ALLOC_FME_gds + ALLOC_BF_gds
59 unsigned long tot_slp_wds = /* total number of ``slop'' words allocated */
60 ALLOC_FUN_slp + ALLOC_THK_slp + ALLOC_CON_slp + ALLOC_TUP_slp
61 + ALLOC_TSO_slp + ALLOC_BH_slp + ALLOC_PAP_slp + ALLOC_PRIM_slp
63 + ALLOC_FMBQ_slp + ALLOC_FME_slp + ALLOC_BF_slp
67 unsigned long tot_wds = /* total words */
68 tot_adm_wds + tot_gds_wds + tot_slp_wds;
70 unsigned long tot_thk_enters = ENT_STATIC_THK_ctr + ENT_DYN_THK_ctr;
71 unsigned long tot_con_enters = ENT_STATIC_CON_ctr + ENT_DYN_CON_ctr;
73 unsigned long tot_fun_direct_enters = ENT_STATIC_FUN_DIRECT_ctr + ENT_DYN_FUN_DIRECT_ctr;
74 unsigned long tot_ind_enters = ENT_STATIC_IND_ctr + ENT_DYN_IND_ctr;
76 // This is the number of times we entered a function via some kind
77 // of slow call. It amounts to all the slow applications, not
78 // counting those that were to too few arguments.
79 unsigned long tot_fun_slow_enters =
81 SLOW_CALL_FUN_TOO_FEW_ctr -
82 SLOW_CALL_PAP_TOO_FEW_ctr;
84 unsigned long tot_known_calls =
85 KNOWN_CALL_ctr + KNOWN_CALL_TOO_FEW_ARGS_ctr +
86 + KNOWN_CALL_EXTRA_ARGS_ctr;
87 unsigned long tot_tail_calls =
88 UNKNOWN_CALL_ctr + tot_known_calls;
90 unsigned long tot_enters =
91 tot_con_enters + tot_fun_direct_enters +
92 tot_ind_enters + ENT_PERM_IND_ctr + ENT_PAP_ctr + tot_thk_enters;
93 unsigned long jump_direct_enters =
94 tot_enters - ENT_VIA_NODE_ctr;
97 unsigned long tot_returns =
98 RET_NEW_ctr + RET_OLD_ctr + RET_UNBOXED_TUP_ctr;
100 unsigned long tot_returns_of_new = RET_NEW_ctr;
102 unsigned long con_updates = UPD_CON_IN_NEW_ctr + UPD_CON_IN_PLACE_ctr;
103 unsigned long pap_updates = UPD_PAP_IN_NEW_ctr + UPD_PAP_IN_PLACE_ctr;
105 unsigned long tot_updates = UPD_SQUEEZED_ctr + pap_updates + con_updates;
107 unsigned long tot_new_updates = UPD_NEW_IND_ctr + UPD_NEW_PERM_IND_ctr;
108 unsigned long tot_old_updates = UPD_OLD_IND_ctr + UPD_OLD_PERM_IND_ctr;
109 unsigned long tot_gengc_updates = tot_new_updates + tot_old_updates;
111 FILE *tf = RtsFlags.TickyFlags.tickyFile;
113 /* If tf = NULL, that means the user passed in stderr for the ticky stats
114 file. According to a comment in RtsFlags.c, this means to use
115 debugBelch to print out messages. But this function prints out a lot
116 of stuff so in order to avoid changing a lot of code, we just dump
117 the same output to stderr (for now). */
121 /* krc: avoid dealing with this just now */
123 fprintf(tf,"\n\nALLOCATIONS: %ld (%ld words total: %ld admin, %ld goods, %ld slop)\n",
124 tot_allocs, tot_wds, tot_adm_wds, tot_gds_wds, tot_slp_wds);
125 fprintf(tf,"\t\t\t\ttotal words:\t 2 3 4 5 6+\n");
127 #define ALLOC_HISTO_MAGIC(categ) \
128 (PC(INTAVG(ALLOC_##categ##_hst[0], ALLOC_##categ##_ctr))), \
129 (PC(INTAVG(ALLOC_##categ##_hst[1], ALLOC_##categ##_ctr))), \
130 (PC(INTAVG(ALLOC_##categ##_hst[2], ALLOC_##categ##_ctr))), \
131 (PC(INTAVG(ALLOC_##categ##_hst[3], ALLOC_##categ##_ctr))), \
132 (PC(INTAVG(ALLOC_##categ##_hst[4], ALLOC_##categ##_ctr)))
134 fprintf(tf,"%7ld (%5.1f%%) function values",
136 PC(INTAVG(ALLOC_FUN_ctr, tot_allocs)));
137 if (ALLOC_FUN_ctr != 0)
138 fprintf(tf,"\t\t%5.1f %5.1f %5.1f %5.1f %5.1f", ALLOC_HISTO_MAGIC(FUN));
141 fprintf(tf,"\n%7ld (%5.1f%%) thunks",
142 ALLOC_SE_THK_ctr + ALLOC_UP_THK_ctr,
143 PC(INTAVG(ALLOC_SE_THK_ctr + ALLOC_UP_THK_ctr, tot_allocs)));
145 #define ALLOC_THK_ctr (ALLOC_UP_THK_ctr + ALLOC_SE_THK_ctr)
146 /* hack to make ALLOC_HISTO_MAGIC still work for THK */
147 if ((ALLOC_SE_THK_ctr + ALLOC_UP_THK_ctr) != 0)
148 fprintf(tf,"\t\t\t\t%5.1f %5.1f %5.1f %5.1f %5.1f", ALLOC_HISTO_MAGIC(THK));
151 fprintf(tf,"\n%7ld (%5.1f%%) data values",
153 PC(INTAVG(ALLOC_CON_ctr, tot_allocs)));
154 if (ALLOC_CON_ctr != 0)
155 fprintf(tf,"\t\t\t%5.1f %5.1f %5.1f %5.1f %5.1f", ALLOC_HISTO_MAGIC(CON));
157 fprintf(tf,"\n%7ld (%5.1f%%) big tuples",
159 PC(INTAVG(ALLOC_TUP_ctr, tot_allocs)));
160 if (ALLOC_TUP_ctr != 0)
161 fprintf(tf,"\t\t\t%5.1f %5.1f %5.1f %5.1f %5.1f", ALLOC_HISTO_MAGIC(TUP));
163 fprintf(tf,"\n%7ld (%5.1f%%) black holes",
165 PC(INTAVG(ALLOC_BH_ctr, tot_allocs)));
166 if (ALLOC_BH_ctr != 0)
167 fprintf(tf,"\t\t\t%5.1f %5.1f %5.1f %5.1f %5.1f", ALLOC_HISTO_MAGIC(BH));
169 fprintf(tf,"\n%7ld (%5.1f%%) prim things",
171 PC(INTAVG(ALLOC_PRIM_ctr, tot_allocs)));
172 if (ALLOC_PRIM_ctr != 0)
173 fprintf(tf,"\t\t\t%5.1f %5.1f %5.1f %5.1f %5.1f", ALLOC_HISTO_MAGIC(PRIM));
175 fprintf(tf,"\n%7ld (%5.1f%%) partial applications",
177 PC(INTAVG(ALLOC_PAP_ctr, tot_allocs)));
178 if (ALLOC_PAP_ctr != 0)
179 fprintf(tf,"\t\t%5.1f %5.1f %5.1f %5.1f %5.1f", ALLOC_HISTO_MAGIC(PAP));
181 fprintf(tf,"\n%7ld (%5.1f%%) thread state objects",
183 PC(INTAVG(ALLOC_TSO_ctr, tot_allocs)));
184 if (ALLOC_TSO_ctr != 0)
185 fprintf(tf,"\t\t%5.1f %5.1f %5.1f %5.1f %5.1f", ALLOC_HISTO_MAGIC(TSO));
187 fprintf(tf,"\n%7ld (%5.1f%%) thread state objects",
189 PC(INTAVG(ALLOC_FMBQ_ctr, tot_allocs)));
190 if (ALLOC_FMBQ_ctr != 0)
191 fprintf(tf,"\t\t%5.1f %5.1f %5.1f %5.1f %5.1f", ALLOC_HISTO_MAGIC(FMBQ));
192 fprintf(tf,"\n%7ld (%5.1f%%) thread state objects",
194 PC(INTAVG(ALLOC_FME_ctr, tot_allocs)));
195 if (ALLOC_FME_ctr != 0)
196 fprintf(tf,"\t\t%5.1f %5.1f %5.1f %5.1f %5.1f", ALLOC_HISTO_MAGIC(FME));
197 fprintf(tf,"\n%7ld (%5.1f%%) thread state objects",
199 PC(INTAVG(ALLOC_BF_ctr, tot_allocs)));
200 if (ALLOC_BF_ctr != 0)
201 fprintf(tf,"\t\t%5.1f %5.1f %5.1f %5.1f %5.1f", ALLOC_HISTO_MAGIC(BF));
206 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);
210 fprintf(tf,"\nSTACK USAGE:\n"); /* NB: some bits are direction sensitive */
213 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",
216 PC(INTAVG(jump_direct_enters,tot_enters)));
217 fprintf(tf,"%7ld (%5.1f%%) thunks\n",
219 PC(INTAVG(tot_thk_enters,tot_enters)));
220 fprintf(tf,"%7ld (%5.1f%%) data values\n",
222 PC(INTAVG(tot_con_enters,tot_enters)));
223 fprintf(tf,"%7ld (%5.1f%%) normal indirections\n",
225 PC(INTAVG(tot_ind_enters,tot_enters)));
226 fprintf(tf,"%7ld (%5.1f%%) permanent indirections\n",
228 PC(INTAVG(ENT_PERM_IND_ctr,tot_enters)));
231 fprintf(tf,"\nFUNCTION ENTRIES: %ld\n", tot_fun_direct_enters);
233 fprintf(tf, "\nTAIL CALLS: %ld, of which %ld (%.lf%%) were to known functions\n",
234 tot_tail_calls, tot_known_calls,
235 PC(INTAVG(tot_known_calls,tot_tail_calls)));
237 fprintf(tf, "\nSLOW APPLICATIONS: %ld evaluated, %ld unevaluated\n",
238 SLOW_CALL_ctr, SLOW_CALL_UNEVALD_ctr);
240 fprintf(tf, " Too few args Correct args Too many args\n");
241 fprintf(tf, " FUN %8ld %8ld %8ld\n",
242 SLOW_CALL_FUN_TOO_FEW_ctr, SLOW_CALL_FUN_CORRECT_ctr, SLOW_CALL_FUN_TOO_MANY_ctr);
243 fprintf(tf, " PAP %8ld %8ld %8ld\n",
244 SLOW_CALL_PAP_TOO_FEW_ctr, SLOW_CALL_PAP_CORRECT_ctr, SLOW_CALL_PAP_TOO_MANY_ctr);
247 fprintf(tf,"\nRETURNS: %ld\n", tot_returns);
248 fprintf(tf,"%7ld (%5.1f%%) from entering a new constructor\n\t\t [the rest from entering an existing constructor]\n",
250 PC(INTAVG(tot_returns_of_new,tot_returns)));
252 /* krc: comment out some of this stuff temporarily */
255 fprintf(tf, "\nRET_NEW: %7ld: ", RET_NEW_ctr);
256 for (i = 0; i < 9; i++) { fprintf(tf, "%5.1f%%",
257 PC(INTAVG(RET_NEW_hst[i],RET_NEW_ctr))); }
259 fprintf(tf, "RET_OLD: %7ld: ", RET_OLD_ctr);
260 for (i = 0; i < 9; i++) { fprintf(tf, "%5.1f%%",
261 PC(INTAVG(RET_OLD_hst[i],RET_OLD_ctr))); }
263 fprintf(tf, "RET_UNBOXED_TUP: %7ld: ", RET_UNBOXED_TUP_ctr);
264 for (i = 0; i < 9; i++) { fprintf(tf, "%5.1f%%",
265 PC(INTAVG(RET_UNBOXED_TUP_hst[i],
266 RET_UNBOXED_TUP_ctr))); }
270 fprintf(tf,"\nUPDATE FRAMES: %ld (%ld omitted from thunks)",
274 fprintf(tf,"\nCATCH FRAMES: %ld", CATCHF_PUSHED_ctr);
276 if (UPDF_RCC_PUSHED_ctr != 0)
277 fprintf(tf,"%7ld restore cost centre frames (%ld omitted)\n",
279 UPDF_RCC_OMITTED_ctr);
281 fprintf(tf,"\nUPDATES: %ld\n", tot_updates);
282 fprintf(tf,"%7ld (%5.1f%%) data values\n\t\t [%ld in place, %ld allocated new space]\n",
284 PC(INTAVG(con_updates,tot_updates)),
285 UPD_CON_IN_PLACE_ctr, UPD_CON_IN_NEW_ctr);
286 fprintf(tf,"%7ld (%5.1f%%) partial applications\n\t\t [%ld in place, %ld allocated new space]\n",
288 PC(INTAVG(pap_updates,tot_updates)),
289 UPD_PAP_IN_PLACE_ctr, UPD_PAP_IN_NEW_ctr);
290 fprintf(tf,"%7ld (%5.1f%%) updates by squeezing\n",
292 PC(INTAVG(UPD_SQUEEZED_ctr, tot_updates)));
294 /* krc: also avoid dealing with this for now */
296 fprintf(tf, "\nUPD_CON_IN_NEW: %7ld: ", UPD_CON_IN_NEW_ctr);
297 for (i = 0; i < 9; i++) { fprintf(tf, "%7ld", UPD_CON_IN_NEW_hst[i]); }
299 fprintf(tf, "UPD_CON_IN_PLACE: %7ld: ", UPD_CON_IN_PLACE_ctr);
300 for (i = 0; i < 9; i++) { fprintf(tf, "%7ld", UPD_CON_IN_PLACE_hst[i]); }
302 fprintf(tf, "UPD_PAP_IN_NEW: %7ld: ", UPD_PAP_IN_NEW_ctr);
303 for (i = 0; i < 9; i++) { fprintf(tf, "%7ld", UPD_PAP_IN_NEW_hst[i]); }
307 if (tot_gengc_updates != 0) {
308 fprintf(tf,"\nNEW GEN UPDATES: %9ld (%5.1f%%)\n",
310 PC(INTAVG(tot_new_updates,tot_gengc_updates)));
311 fprintf(tf,"OLD GEN UPDATES: %9ld (%5.1f%%)\n",
313 PC(INTAVG(tot_old_updates,tot_gengc_updates)));
316 fprintf(tf,"\nTotal bytes copied during GC: %ld\n",
317 GC_WORDS_COPIED_ctr * sizeof(W_));
319 printRegisteredCounterInfo(tf);
321 fprintf(tf,"\n**************************************************\n");
323 /* here, we print out all the raw numbers; these are really
324 more useful when we want to snag them for subsequent
325 rdb-etc processing. WDP 95/11
328 #define PR_CTR(ctr) \
329 do { fprintf(tf,"%7ld " #ctr "\n", ctr); } while(0)
330 /* COND_PR_CTR takes a boolean; if false then msg is the printname rather than ctr */
331 #define COND_PR_CTR(ctr,b,msg) \
332 if (b) { fprintf(tf,"%7ld " #ctr "\n", ctr); } else { fprintf(tf,"%7ld " msg "\n", ctr); }
333 #define PR_HST(hst,i) \
334 do { fprintf(tf,"%7ld " #hst "_" #i "\n", hst[i]); } while(0)
336 PR_CTR(ALLOC_HEAP_ctr);
337 PR_CTR(ALLOC_HEAP_tot);
339 PR_CTR(ALLOC_FUN_ctr);
340 PR_CTR(ALLOC_FUN_adm);
341 PR_CTR(ALLOC_FUN_gds);
342 PR_CTR(ALLOC_FUN_slp);
344 /* krc: comment out some of this stuff temporarily
345 PR_HST(ALLOC_FUN_hst,0);
346 PR_HST(ALLOC_FUN_hst,1);
347 PR_HST(ALLOC_FUN_hst,2);
348 PR_HST(ALLOC_FUN_hst,3);
349 PR_HST(ALLOC_FUN_hst,4);
350 PR_CTR(ALLOC_UP_THK_ctr);
351 PR_CTR(ALLOC_SE_THK_ctr);
352 PR_CTR(ALLOC_THK_adm);
353 PR_CTR(ALLOC_THK_gds);
354 PR_CTR(ALLOC_THK_slp);
355 PR_HST(ALLOC_THK_hst,0);
356 PR_HST(ALLOC_THK_hst,1);
357 PR_HST(ALLOC_THK_hst,2);
358 PR_HST(ALLOC_THK_hst,3);
359 PR_HST(ALLOC_THK_hst,4);
360 PR_CTR(ALLOC_CON_ctr);
361 PR_CTR(ALLOC_CON_adm);
362 PR_CTR(ALLOC_CON_gds);
363 PR_CTR(ALLOC_CON_slp);
364 PR_HST(ALLOC_CON_hst,0);
365 PR_HST(ALLOC_CON_hst,1);
366 PR_HST(ALLOC_CON_hst,2);
367 PR_HST(ALLOC_CON_hst,3);
368 PR_HST(ALLOC_CON_hst,4);
369 PR_CTR(ALLOC_TUP_ctr);
370 PR_CTR(ALLOC_TUP_adm);
371 PR_CTR(ALLOC_TUP_gds);
372 PR_CTR(ALLOC_TUP_slp);
373 PR_HST(ALLOC_TUP_hst,0);
374 PR_HST(ALLOC_TUP_hst,1);
375 PR_HST(ALLOC_TUP_hst,2);
376 PR_HST(ALLOC_TUP_hst,3);
377 PR_HST(ALLOC_TUP_hst,4);
378 PR_CTR(ALLOC_BH_ctr);
379 PR_CTR(ALLOC_BH_adm);
380 PR_CTR(ALLOC_BH_gds);
381 PR_CTR(ALLOC_BH_slp);
382 PR_HST(ALLOC_BH_hst,0);
383 PR_HST(ALLOC_BH_hst,1);
384 PR_HST(ALLOC_BH_hst,2);
385 PR_HST(ALLOC_BH_hst,3);
386 PR_HST(ALLOC_BH_hst,4);
387 PR_CTR(ALLOC_PRIM_ctr);
388 PR_CTR(ALLOC_PRIM_adm);
389 PR_CTR(ALLOC_PRIM_gds);
390 PR_CTR(ALLOC_PRIM_slp);
391 PR_HST(ALLOC_PRIM_hst,0);
392 PR_HST(ALLOC_PRIM_hst,1);
393 PR_HST(ALLOC_PRIM_hst,2);
394 PR_HST(ALLOC_PRIM_hst,3);
395 PR_HST(ALLOC_PRIM_hst,4);
396 PR_CTR(ALLOC_PAP_ctr);
397 PR_CTR(ALLOC_PAP_adm);
398 PR_CTR(ALLOC_PAP_gds);
399 PR_CTR(ALLOC_PAP_slp);
400 PR_HST(ALLOC_PAP_hst,0);
401 PR_HST(ALLOC_PAP_hst,1);
402 PR_HST(ALLOC_PAP_hst,2);
403 PR_HST(ALLOC_PAP_hst,3);
404 PR_HST(ALLOC_PAP_hst,4);
406 PR_CTR(ALLOC_TSO_ctr);
407 PR_CTR(ALLOC_TSO_adm);
408 PR_CTR(ALLOC_TSO_gds);
409 PR_CTR(ALLOC_TSO_slp);
410 PR_HST(ALLOC_TSO_hst,0);
411 PR_HST(ALLOC_TSO_hst,1);
412 PR_HST(ALLOC_TSO_hst,2);
413 PR_HST(ALLOC_TSO_hst,3);
414 PR_HST(ALLOC_TSO_hst,4);
417 PR_CTR(ALLOC_FMBQ_ctr);
418 PR_CTR(ALLOC_FMBQ_adm);
419 PR_CTR(ALLOC_FMBQ_gds);
420 PR_CTR(ALLOC_FMBQ_slp);
421 PR_HST(ALLOC_FMBQ_hst,0);
422 PR_HST(ALLOC_FMBQ_hst,1);
423 PR_HST(ALLOC_FMBQ_hst,2);
424 PR_HST(ALLOC_FMBQ_hst,3);
425 PR_HST(ALLOC_FMBQ_hst,4);
426 PR_CTR(ALLOC_FME_ctr);
427 PR_CTR(ALLOC_FME_adm);
428 PR_CTR(ALLOC_FME_gds);
429 PR_CTR(ALLOC_FME_slp);
430 PR_HST(ALLOC_FME_hst,0);
431 PR_HST(ALLOC_FME_hst,1);
432 PR_HST(ALLOC_FME_hst,2);
433 PR_HST(ALLOC_FME_hst,3);
434 PR_HST(ALLOC_FME_hst,4);
435 PR_CTR(ALLOC_BF_ctr);
436 PR_CTR(ALLOC_BF_adm);
437 PR_CTR(ALLOC_BF_gds);
438 PR_CTR(ALLOC_BF_slp);
439 PR_HST(ALLOC_BF_hst,0);
440 PR_HST(ALLOC_BF_hst,1);
441 PR_HST(ALLOC_BF_hst,2);
442 PR_HST(ALLOC_BF_hst,3);
443 PR_HST(ALLOC_BF_hst,4);
447 PR_CTR(ENT_VIA_NODE_ctr);
448 PR_CTR(ENT_STATIC_CON_ctr);
449 PR_CTR(ENT_DYN_CON_ctr);
450 PR_CTR(ENT_STATIC_FUN_DIRECT_ctr);
451 PR_CTR(ENT_DYN_FUN_DIRECT_ctr);
452 PR_CTR(ENT_STATIC_IND_ctr);
453 PR_CTR(ENT_DYN_IND_ctr);
455 /* The counters ENT_PERM_IND and UPD_{NEW,OLD}_PERM_IND are not dumped
456 * at the end of execution unless update squeezing is turned off (+RTS
457 * -Z =RtsFlags.GcFlags.squeezeUpdFrames), as they will be wrong
458 * otherwise. Why? Because for each update frame squeezed out, we
459 * count an UPD_NEW_PERM_IND *at GC time* (i.e., too early). And
460 * further, when we enter the closure that has been updated, we count
461 * the ENT_PERM_IND, but we then enter the PERM_IND that was built for
462 * the next update frame below, and so on down the chain until we
463 * finally reach the value. Thus we count many new ENT_PERM_INDs too
466 * This of course refers to the -ticky version that uses PERM_INDs to
467 * determine the number of closures entered 0/1/>1. KSW 1999-04. */
468 COND_PR_CTR(ENT_PERM_IND_ctr,RtsFlags.GcFlags.squeezeUpdFrames == rtsFalse,"E!NT_PERM_IND_ctr requires +RTS -Z");
472 PR_CTR(ENT_AP_STACK_ctr);
474 PR_CTR(ENT_STATIC_THK_ctr);
475 PR_CTR(ENT_DYN_THK_ctr);
477 PR_CTR(SLOW_CALL_v_ctr);
478 PR_CTR(SLOW_CALL_f_ctr);
479 PR_CTR(SLOW_CALL_d_ctr);
480 PR_CTR(SLOW_CALL_l_ctr);
481 PR_CTR(SLOW_CALL_n_ctr);
482 PR_CTR(SLOW_CALL_p_ctr);
483 PR_CTR(SLOW_CALL_pv_ctr);
484 PR_CTR(SLOW_CALL_pp_ctr);
485 PR_CTR(SLOW_CALL_ppv_ctr);
486 PR_CTR(SLOW_CALL_ppp_ctr);
487 PR_CTR(SLOW_CALL_pppv_ctr);
488 PR_CTR(SLOW_CALL_pppp_ctr);
489 PR_CTR(SLOW_CALL_ppppp_ctr);
490 PR_CTR(SLOW_CALL_pppppp_ctr);
491 PR_CTR(SLOW_CALL_OTHER_ctr);
493 PR_CTR(UNKNOWN_CALL_ctr);
494 PR_CTR(KNOWN_CALL_ctr);
495 PR_CTR(KNOWN_CALL_TOO_FEW_ARGS_ctr);
496 PR_CTR(KNOWN_CALL_EXTRA_ARGS_ctr);
497 PR_CTR(MULTI_CHUNK_SLOW_CALL_ctr);
498 PR_CTR(MULTI_CHUNK_SLOW_CALL_CHUNKS_ctr);
499 PR_CTR(SLOW_CALL_ctr);
500 PR_CTR(SLOW_CALL_FUN_TOO_FEW_ctr);
501 PR_CTR(SLOW_CALL_FUN_CORRECT_ctr);
502 PR_CTR(SLOW_CALL_FUN_TOO_MANY_ctr);
503 PR_CTR(SLOW_CALL_PAP_TOO_FEW_ctr);
504 PR_CTR(SLOW_CALL_PAP_CORRECT_ctr);
505 PR_CTR(SLOW_CALL_PAP_TOO_MANY_ctr);
506 PR_CTR(SLOW_CALL_UNEVALD_ctr);
508 /* krc: put off till later... */
510 PR_HST(SLOW_CALL_hst,0);
511 PR_HST(SLOW_CALL_hst,1);
512 PR_HST(SLOW_CALL_hst,2);
513 PR_HST(SLOW_CALL_hst,3);
514 PR_HST(SLOW_CALL_hst,4);
515 PR_HST(SLOW_CALL_hst,5);
516 PR_HST(SLOW_CALL_hst,6);
517 PR_HST(SLOW_CALL_hst,7);
522 PR_CTR(RET_UNBOXED_TUP_ctr);
524 /* krc: put off till later... */
526 PR_HST(RET_NEW_hst,0);
527 PR_HST(RET_NEW_hst,1);
528 PR_HST(RET_NEW_hst,2);
529 PR_HST(RET_NEW_hst,3);
530 PR_HST(RET_NEW_hst,4);
531 PR_HST(RET_NEW_hst,5);
532 PR_HST(RET_NEW_hst,6);
533 PR_HST(RET_NEW_hst,7);
534 PR_HST(RET_NEW_hst,8);
535 PR_HST(RET_OLD_hst,0);
536 PR_HST(RET_OLD_hst,1);
537 PR_HST(RET_OLD_hst,2);
538 PR_HST(RET_OLD_hst,3);
539 PR_HST(RET_OLD_hst,4);
540 PR_HST(RET_OLD_hst,5);
541 PR_HST(RET_OLD_hst,6);
542 PR_HST(RET_OLD_hst,7);
543 PR_HST(RET_OLD_hst,8);
544 PR_HST(RET_UNBOXED_TUP_hst,0);
545 PR_HST(RET_UNBOXED_TUP_hst,1);
546 PR_HST(RET_UNBOXED_TUP_hst,2);
547 PR_HST(RET_UNBOXED_TUP_hst,3);
548 PR_HST(RET_UNBOXED_TUP_hst,4);
549 PR_HST(RET_UNBOXED_TUP_hst,5);
550 PR_HST(RET_UNBOXED_TUP_hst,6);
551 PR_HST(RET_UNBOXED_TUP_hst,7);
552 PR_HST(RET_UNBOXED_TUP_hst,8);
555 PR_CTR(UPDF_OMITTED_ctr);
556 PR_CTR(UPDF_PUSHED_ctr);
557 PR_CTR(CATCHF_PUSHED_ctr);
559 PR_CTR(UPDF_RCC_PUSHED_ctr);
560 PR_CTR(UPDF_RCC_OMITTED_ctr);
562 PR_CTR(UPD_SQUEEZED_ctr);
563 PR_CTR(UPD_CON_IN_NEW_ctr);
564 PR_CTR(UPD_CON_IN_PLACE_ctr);
565 PR_CTR(UPD_PAP_IN_NEW_ctr);
566 PR_CTR(UPD_PAP_IN_PLACE_ctr);
568 PR_CTR(UPD_BH_UPDATABLE_ctr);
569 PR_CTR(UPD_BH_SINGLE_ENTRY_ctr);
570 PR_CTR(UPD_CAF_BH_UPDATABLE_ctr);
571 PR_CTR(UPD_CAF_BH_SINGLE_ENTRY_ctr);
573 /* krc: put off till later...*/
575 PR_HST(UPD_CON_IN_NEW_hst,0);
576 PR_HST(UPD_CON_IN_NEW_hst,1);
577 PR_HST(UPD_CON_IN_NEW_hst,2);
578 PR_HST(UPD_CON_IN_NEW_hst,3);
579 PR_HST(UPD_CON_IN_NEW_hst,4);
580 PR_HST(UPD_CON_IN_NEW_hst,5);
581 PR_HST(UPD_CON_IN_NEW_hst,6);
582 PR_HST(UPD_CON_IN_NEW_hst,7);
583 PR_HST(UPD_CON_IN_NEW_hst,8);
584 PR_HST(UPD_PAP_IN_NEW_hst,0);
585 PR_HST(UPD_PAP_IN_NEW_hst,1);
586 PR_HST(UPD_PAP_IN_NEW_hst,2);
587 PR_HST(UPD_PAP_IN_NEW_hst,3);
588 PR_HST(UPD_PAP_IN_NEW_hst,4);
589 PR_HST(UPD_PAP_IN_NEW_hst,5);
590 PR_HST(UPD_PAP_IN_NEW_hst,6);
591 PR_HST(UPD_PAP_IN_NEW_hst,7);
592 PR_HST(UPD_PAP_IN_NEW_hst,8);
595 PR_CTR(UPD_NEW_IND_ctr);
596 /* see comment on ENT_PERM_IND_ctr */
597 COND_PR_CTR(UPD_NEW_PERM_IND_ctr,RtsFlags.GcFlags.squeezeUpdFrames == rtsFalse,"U!PD_NEW_PERM_IND_ctr requires +RTS -Z");
598 PR_CTR(UPD_OLD_IND_ctr);
599 /* see comment on ENT_PERM_IND_ctr */
600 COND_PR_CTR(UPD_OLD_PERM_IND_ctr,RtsFlags.GcFlags.squeezeUpdFrames == rtsFalse,"U!PD_OLD_PERM_IND_ctr requires +RTS -Z");
602 PR_CTR(GC_SEL_ABANDONED_ctr);
603 PR_CTR(GC_SEL_MINOR_ctr);
604 PR_CTR(GC_SEL_MAJOR_ctr);
605 PR_CTR(GC_FAILED_PROMOTION_ctr);
606 PR_CTR(GC_WORDS_COPIED_ctr);
609 /* Data structure used in ``registering'' one of these counters. */
611 StgEntCounter *ticky_entry_ctrs = NULL; /* root of list of them */
613 /* To print out all the registered-counter info: */
616 printRegisteredCounterInfo (FILE *tf)
620 if ( ticky_entry_ctrs != NULL ) {
621 fprintf(tf,"\n**************************************************\n\n");
623 fprintf(tf, "%11s%11s %6s%6s %-11s%-30s\n",
624 "Entries", "Allocs", "Arity", "Stack", "Kinds", "Function");
625 fprintf(tf, "--------------------------------------------------------------------------------\n");
626 /* Function name at the end so it doesn't mess up the tabulation */
628 for (p = ticky_entry_ctrs; p != NULL; p = p->link) {
629 fprintf(tf, "%11ld%11ld %6u%6u %-11s%-30s",
642 /* Catch-all top-level counter struct. Allocations from CAFs will go
650 #endif /* TICKY_TICKY */