1 /* -----------------------------------------------------------------------------
2 * $Id: Stats.c,v 1.38 2001/11/25 16:59:11 sof Exp $
4 * (c) The GHC Team, 1998-1999
6 * Statistics and timing-related functions.
8 * ---------------------------------------------------------------------------*/
10 /* Alas, no. This source is non-posix.
11 #include "PosixSource.h"
17 #include "StoragePriv.h"
21 #include "ParTicky.h" /* ToDo: move into Rts.h */
22 #include "Profiling.h"
28 #ifndef mingw32_TARGET_OS
29 # ifdef HAVE_SYS_TIMES_H
30 # include <sys/times.h>
34 #ifdef HAVE_SYS_TIME_H
44 #if ! irix_TARGET_OS && ! defined(mingw32_TARGET_OS)
45 # if defined(HAVE_SYS_RESOURCE_H)
46 # include <sys/resource.h>
50 #ifdef HAVE_SYS_TIMEB_H
51 #include <sys/timeb.h>
62 #if defined(PAR) || !(!defined(HAVE_GETRUSAGE) || irix_TARGET_OS || defined(mingw32_TARGET_OS) || defined(cygwin32_TARGET_OS))
63 #include <sys/resource.h>
67 #define BIG_STRING_LEN 512
69 /* We're not trying to be terribly accurate here, using the
70 * basic times() function to get a resolution of about 100ths of a
71 * second, depending on the OS. A long int will do fine for holding
74 #define TICK_TYPE long int
75 #define TICK_TO_DBL(t) ((double)(t) / TicksPerSecond)
77 static int TicksPerSecond = 0;
79 static TICK_TYPE ElapsedTimeStart = 0;
80 static TICK_TYPE CurrentElapsedTime = 0;
81 static TICK_TYPE CurrentUserTime = 0;
83 static TICK_TYPE InitUserTime = 0;
84 static TICK_TYPE InitElapsedTime = 0;
85 static TICK_TYPE InitElapsedStamp = 0;
87 static TICK_TYPE MutUserTime = 0;
88 static TICK_TYPE MutElapsedTime = 0;
89 static TICK_TYPE MutElapsedStamp = 0;
91 static TICK_TYPE ExitUserTime = 0;
92 static TICK_TYPE ExitElapsedTime = 0;
94 static ullong GC_tot_alloc = 0;
95 static ullong GC_tot_copied = 0;
97 static TICK_TYPE GC_start_time = 0, GC_tot_time = 0; /* User GC Time */
98 static TICK_TYPE GCe_start_time = 0, GCe_tot_time = 0; /* Elapsed GC time */
101 static TICK_TYPE RP_start_time = 0, RP_tot_time = 0; /* retainer prof user time */
102 static TICK_TYPE RPe_start_time = 0, RPe_tot_time = 0; /* retainer prof elap time */
104 static TICK_TYPE LDV_start_time = 0, LDV_tot_time = 0; /* LDV prof user time */
105 static TICK_TYPE LDVe_start_time = 0, LDVe_tot_time = 0; /* LDV prof elap time */
109 #define PROF_VAL(x) x
111 #define PROF_VAL(x) 0
114 lnat MaxResidency = 0; /* in words; for stats only */
115 lnat AvgResidency = 0;
116 lnat ResidencySamples = 0; /* for stats only */
118 static lnat GC_start_faults = 0, GC_end_faults = 0;
120 static TICK_TYPE *GC_coll_times;
122 static void getTimes(void);
123 static nat pageFaults(void);
125 /* elapsedtime() -- The current elapsed time in seconds */
127 #if defined(mingw32_TARGET_OS) || defined(cygwin32_TARGET_OS)
128 #define HNS_PER_SEC 10000000LL /* FILETIMES are in units of 100ns */
129 /* Convert FILETIMEs into secs */
130 #define FT2longlong(ll,ft) \
131 (ll)=(ft).dwHighDateTime; \
133 (ll) |= (ft).dwLowDateTime; \
134 (ll) /= (unsigned long long) (HNS_PER_SEC / CLOCKS_PER_SEC)
137 #if defined(mingw32_TARGET_OS) || defined(cygwin32_TARGET_OS)
138 /* cygwin32 or mingw32 version */
142 static int is_win9x = -1;
144 FILETIME creationTime, exitTime, userTime, kernelTime = {0,0};
145 long long int kT, uT;
148 /* figure out whether we're on a Win9x box or not. */
152 /* Need to init the size field first.*/
153 oi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
154 b = GetVersionEx(&oi);
156 is_win9x = ( (b && (oi.dwPlatformId & VER_PLATFORM_WIN32_WINDOWS)) ? 1 : 0);
160 /* On Win9x, just attribute all running time to the user. */
164 SystemTimeToFileTime(&st,&userTime);
166 /* ToDo: pin down elapsed times to just the OS thread(s) that
167 are evaluating/managing Haskell code.
169 if (!GetProcessTimes (GetCurrentProcess(), &creationTime,
170 &exitTime, &kernelTime, &userTime)) {
171 /* Probably on a Win95 box..*/
172 CurrentElapsedTime = 0;
178 FT2longlong(kT,kernelTime);
179 FT2longlong(uT,userTime);
180 CurrentElapsedTime = uT + kT;
181 CurrentUserTime = uT;
184 /* Adjust for the fact that we're using system time & not
185 process time on Win9x. */
186 CurrentUserTime -= ElapsedTimeStart;
187 CurrentElapsedTime -= ElapsedTimeStart;
198 /* We will #ifdef around the fprintf for machines
199 we *know* are unsupported. (WDP 94/05)
201 fprintf(stderr, "NOTE: `getTimes' does nothing!\n");
204 #else /* not stumped */
206 clock_t r = times(&t);
208 CurrentElapsedTime = r;
209 CurrentUserTime = t.tms_utime;
215 /* mut_user_time_during_GC() and mut_user_time()
217 * The former function can be used to get the current mutator time
218 * *during* a GC, i.e. between stat_startGC and stat_endGC. This is
219 * used in the heap profiler for accurately time stamping the heap
222 * ATTENTION: mut_user_time_during_GC() relies on GC_start_time being
223 * defined in stat_startGC() - to minimise system calls,
224 * GC_start_time is, however, only defined when really needed (check
225 * stat_startGC() for details)
228 mut_user_time_during_GC( void )
230 return TICK_TO_DBL(GC_start_time - GC_tot_time - PROF_VAL(RP_tot_time - LDV_tot_time));
234 mut_user_time( void )
237 return TICK_TO_DBL(CurrentUserTime - GC_tot_time - PROF_VAL(RP_tot_time - LDV_tot_time));
242 mut_user_time_during_RP() is similar to mut_user_time_during_GC();
243 it returns the MUT time during retainer profiling.
244 The same is for mut_user_time_during_LDV();
247 mut_user_time_during_RP( void )
249 return TICK_TO_DBL(RP_start_time - GC_tot_time - RP_tot_time - LDV_tot_time);
253 mut_user_time_during_LDV( void )
255 return TICK_TO_DBL(LDV_start_time - GC_tot_time - RP_tot_time - LDV_tot_time);
257 #endif /* PROFILING */
262 /* ToDo (on NT): better, get this via the performance data
263 that's stored in the registry. */
264 # if !defined(HAVE_GETRUSAGE) || irix_TARGET_OS || defined(mingw32_TARGET_OS) || defined(cygwin32_TARGET_OS)
269 getrusage(RUSAGE_SELF, &t);
278 FILE *sf = RtsFlags.GcFlags.statsFile;
280 if (RtsFlags.GcFlags.giveStats >= VERBOSE_GC_STATS) {
281 fprintf(sf, " Alloc Collect Live GC GC TOT TOT Page Flts\n");
282 fprintf(sf, " bytes bytes bytes user elap user elap\n");
285 (TICK_TYPE *)stgMallocBytes(
286 sizeof(TICK_TYPE)*RtsFlags.GcFlags.generations,
288 for (i = 0; i < RtsFlags.GcFlags.generations; i++) {
289 GC_coll_times[i] = 0;
293 /* -----------------------------------------------------------------------------
294 Initialisation time...
295 -------------------------------------------------------------------------- */
300 /* Determine TicksPerSecond ... */
301 #if defined(CLK_TCK) /* defined by POSIX */
302 TicksPerSecond = CLK_TCK;
304 #elif defined(HAVE_SYSCONF)
307 ticks = sysconf(_SC_CLK_TCK);
309 fprintf(stderr, "stat_init: bad call to 'sysconf'!\n");
310 stg_exit(EXIT_FAILURE);
312 TicksPerSecond = ticks;
314 /* no "sysconf" or CLK_TCK; had better guess */
318 #elif defined(CLOCKS_PER_SEC)
319 TicksPerSecond = CLOCKS_PER_SEC;
321 #else /* had better guess wildly */
322 /* We will #ifdef around the fprintf for machines
323 we *know* are unsupported. (WDP 94/05)
325 fprintf(stderr, "NOTE: Guessing `TicksPerSecond = 60'!\n");
330 ElapsedTimeStart = CurrentElapsedTime;
337 InitUserTime = CurrentUserTime;
338 InitElapsedStamp = CurrentElapsedTime;
339 if (ElapsedTimeStart > CurrentElapsedTime) {
342 InitElapsedTime = CurrentElapsedTime - ElapsedTimeStart;
346 /* -----------------------------------------------------------------------------
347 stat_startExit and stat_endExit
349 These two measure the time taken in shutdownHaskell().
350 -------------------------------------------------------------------------- */
356 MutElapsedStamp = CurrentElapsedTime;
357 MutElapsedTime = CurrentElapsedTime - GCe_tot_time - InitElapsedStamp;
358 if (MutElapsedTime < 0) { MutElapsedTime = 0; } /* sometimes -0.00 */
360 /* for SMP, we don't know the mutator time yet, we have to inspect
361 * all the running threads to find out, and they haven't stopped
362 * yet. So we just timestamp MutUserTime at this point so we can
363 * calculate the EXIT time. The real MutUserTime is calculated
364 * in stat_exit below.
367 MutUserTime = CurrentUserTime;
369 MutUserTime = CurrentUserTime - GC_tot_time - PROF_VAL(RP_tot_time - LDV_tot_time) - InitUserTime;
370 if (MutUserTime < 0) { MutUserTime = 0; }
379 ExitUserTime = CurrentUserTime - MutUserTime;
381 ExitUserTime = CurrentUserTime - MutUserTime - GC_tot_time - PROF_VAL(RP_tot_time - LDV_tot_time) - InitUserTime;
383 ExitElapsedTime = CurrentElapsedTime - MutElapsedStamp;
384 if (ExitUserTime < 0) {
387 if (ExitElapsedTime < 0) {
392 /* -----------------------------------------------------------------------------
393 Called at the beginning of each GC
394 -------------------------------------------------------------------------- */
396 static nat rub_bell = 0;
398 /* initialise global variables needed during GC
400 * * GC_start_time is read in mut_user_time_during_GC(), which in turn is
401 * needed if either PROFILING or DEBUGing is enabled
406 nat bell = RtsFlags.GcFlags.ringBell;
410 fprintf(stderr, " GC ");
413 fprintf(stderr, "\007");
417 #if defined(PROFILING) || defined(DEBUG)
419 GC_start_time = CurrentUserTime; /* needed in mut_user_time_during_GC() */
422 if (RtsFlags.GcFlags.giveStats != NO_GC_STATS) {
423 #if !defined(PROFILING) && !defined(DEBUG)
425 GC_start_time = CurrentUserTime;
427 GCe_start_time = CurrentElapsedTime;
428 if (RtsFlags.GcFlags.giveStats) {
429 GC_start_faults = pageFaults();
434 /* -----------------------------------------------------------------------------
435 Called at the end of each GC
436 -------------------------------------------------------------------------- */
439 stat_endGC(lnat alloc, lnat collect, lnat live, lnat copied, lnat gen)
441 FILE *sf = RtsFlags.GcFlags.statsFile;
443 if (RtsFlags.GcFlags.giveStats != NO_GC_STATS) {
444 TICK_TYPE time, etime, gc_time, gc_etime;
447 time = CurrentUserTime;
448 etime = CurrentElapsedTime;
449 gc_time = time - GC_start_time;
450 gc_etime = etime - GCe_start_time;
452 if (RtsFlags.GcFlags.giveStats == VERBOSE_GC_STATS && sf != NULL) {
453 nat faults = pageFaults();
455 fprintf(sf, "%9ld %9ld %9ld",
456 alloc*sizeof(W_), collect*sizeof(W_), live*sizeof(W_));
457 fprintf(sf, " %5.2f %5.2f %7.2f %7.2f %4ld %4ld (Gen: %2ld)\n",
458 TICK_TO_DBL(gc_time),
459 TICK_TO_DBL(gc_etime),
461 TICK_TO_DBL(etime - ElapsedTimeStart),
462 faults - GC_start_faults,
463 GC_start_faults - GC_end_faults,
466 GC_end_faults = faults;
470 GC_coll_times[gen] += gc_time;
472 GC_tot_copied += (ullong) copied;
473 GC_tot_alloc += (ullong) alloc;
474 GC_tot_time += gc_time;
475 GCe_tot_time += gc_etime;
480 pthread_t me = pthread_self();
482 for (i = 0; i < RtsFlags.ParFlags.nNodes; i++) {
483 if (me == task_ids[i].id) {
484 task_ids[i].gc_time += gc_time;
485 task_ids[i].gc_etime += gc_etime;
492 if (gen == RtsFlags.GcFlags.generations-1) { /* major GC? */
493 if (live > MaxResidency) {
497 AvgResidency += live;
502 fprintf(stderr, "\b\b\b \b\b\b");
507 /* -----------------------------------------------------------------------------
508 Called at the beginning of each Retainer Profiliing
509 -------------------------------------------------------------------------- */
515 RP_start_time = CurrentUserTime;
516 RPe_start_time = CurrentElapsedTime;
518 #endif /* PROFILING */
520 /* -----------------------------------------------------------------------------
521 Called at the end of each Retainer Profiliing
522 -------------------------------------------------------------------------- */
527 nat retainerGeneration,
528 #ifdef DEBUG_RETAINER
532 double averageNumVisit,
537 RP_tot_time += CurrentUserTime - RP_start_time;
538 RPe_tot_time += CurrentElapsedTime - RPe_start_time;
540 fprintf(prof_file, "Retainer Profiling: %d, at %f seconds\n",
541 retainerGeneration, mut_user_time_during_RP());
542 #ifdef DEBUG_RETAINER
543 fprintf(prof_file, "\tMax C stack size = %u\n", maxCStackSize);
544 fprintf(prof_file, "\tMax auxiliary stack size = %u\n", maxStackSize);
546 fprintf(prof_file, "\tAverage number of visits per object = %f\n", averageNumVisit);
547 fprintf(prof_file, "\tCurrent total costs in bytes = %u\n", allCost * sizeof(StgWord));
548 fprintf(prof_file, "\tNumber of retainer sets = %u\n\n", numSet);
550 #endif /* PROFILING */
552 /* -----------------------------------------------------------------------------
553 Called at the beginning of each LDV Profiliing
554 -------------------------------------------------------------------------- */
560 LDV_start_time = CurrentUserTime;
561 LDVe_start_time = CurrentElapsedTime;
563 #endif /* PROFILING */
565 /* -----------------------------------------------------------------------------
566 Called at the end of each LDV Profiliing
567 -------------------------------------------------------------------------- */
573 LDV_tot_time += CurrentUserTime - LDV_start_time;
574 LDVe_tot_time += CurrentElapsedTime - LDVe_start_time;
576 #endif /* PROFILING */
578 /* -----------------------------------------------------------------------------
581 Called under SMP when a worker thread finishes. We drop the timing
582 stats for this thread into the task_ids struct for that thread.
583 -------------------------------------------------------------------------- */
587 stat_workerStop(void)
590 pthread_t me = pthread_self();
592 for (i = 0; i < RtsFlags.ParFlags.nNodes; i++) {
593 if (task_ids[i].id == me) {
594 task_ids[i].mut_time = usertime() - task_ids[i].gc_time;
595 task_ids[i].mut_etime = elapsedtime()
597 - task_ids[i].elapsedtimestart;
598 if (task_ids[i].mut_time < 0.0) { task_ids[i].mut_time = 0.0; }
599 if (task_ids[i].mut_etime < 0.0) { task_ids[i].mut_etime = 0.0; }
605 /* -----------------------------------------------------------------------------
606 Called at the end of execution
608 NOTE: number of allocations is not entirely accurate: it doesn't
609 take into account the few bytes at the end of the heap that
610 were left unused when the heap-check failed.
611 -------------------------------------------------------------------------- */
616 FILE *sf = RtsFlags.GcFlags.statsFile;
618 if (RtsFlags.GcFlags.giveStats != NO_GC_STATS) {
620 char temp[BIG_STRING_LEN];
623 nat g, total_collections = 0;
626 time = CurrentUserTime;
627 etime = CurrentElapsedTime - ElapsedTimeStart;
629 GC_tot_alloc += alloc;
631 /* avoid divide by zero if time is measured as 0.00 seconds -- SDM */
632 if (time == 0.0) time = 1;
633 if (etime == 0.0) etime = 1;
635 /* Count total garbage collections */
636 for (g = 0; g < RtsFlags.GcFlags.generations; g++)
637 total_collections += generations[g].collections;
639 /* For SMP, we have to get the user time from each thread
640 * and try to work out the total time.
645 for (i = 0; i < RtsFlags.ParFlags.nNodes; i++) {
646 MutUserTime += task_ids[i].mut_time;
649 time = MutUserTime + GC_tot_time + InitUserTime + ExitUserTime;
650 if (MutUserTime < 0) { MutUserTime = 0; }
653 if (RtsFlags.GcFlags.giveStats >= VERBOSE_GC_STATS && sf != NULL) {
654 fprintf(sf, "%9ld %9.9s %9.9s", (lnat)alloc*sizeof(W_), "", "");
655 fprintf(sf, " %5.2f %5.2f\n\n", 0.0, 0.0);
658 if (RtsFlags.GcFlags.giveStats >= SUMMARY_GC_STATS && sf != NULL) {
659 ullong_format_string(GC_tot_alloc*sizeof(W_),
660 temp, rtsTrue/*commas*/);
661 fprintf(sf, "%11s bytes allocated in the heap\n", temp);
663 ullong_format_string(GC_tot_copied*sizeof(W_),
664 temp, rtsTrue/*commas*/);
665 fprintf(sf, "%11s bytes copied during GC\n", temp);
667 if ( ResidencySamples > 0 ) {
668 ullong_format_string(MaxResidency*sizeof(W_),
669 temp, rtsTrue/*commas*/);
670 fprintf(sf, "%11s bytes maximum residency (%ld sample(s))\n",
671 temp, ResidencySamples);
675 /* Print garbage collections in each gen */
676 for (g = 0; g < RtsFlags.GcFlags.generations; g++) {
677 fprintf(sf, "%11d collections in generation %d (%6.2fs)\n",
678 generations[g].collections, g,
679 TICK_TO_DBL(GC_coll_times[g]));
682 fprintf(sf,"\n%11ld Mb total memory in use\n\n",
683 mblocks_allocated * MBLOCK_SIZE / (1024 * 1024));
688 for (i = 0; i < RtsFlags.ParFlags.nNodes; i++) {
689 fprintf(sf, " Task %2d: MUT time: %6.2fs (%6.2fs elapsed)\n"
690 " GC time: %6.2fs (%6.2fs elapsed)\n\n",
692 TICK_TO_DBL(task_ids[i].mut_time),
693 TICK_TO_DBL(task_ids[i].mut_etime),
694 TICK_TO_DBL(task_ids[i].gc_time),
695 TICK_TO_DBL(task_ids[i].gc_etime));
700 fprintf(sf, " INIT time %6.2fs (%6.2fs elapsed)\n",
701 TICK_TO_DBL(InitUserTime), TICK_TO_DBL(InitElapsedTime));
702 fprintf(sf, " MUT time %6.2fs (%6.2fs elapsed)\n",
703 TICK_TO_DBL(MutUserTime), TICK_TO_DBL(MutElapsedTime));
704 fprintf(sf, " GC time %6.2fs (%6.2fs elapsed)\n",
705 TICK_TO_DBL(GC_tot_time), TICK_TO_DBL(GCe_tot_time));
707 if (RtsFlags.ProfFlags.doHeapProfile == HEAP_BY_RETAINER)
708 fprintf(sf, " RP time %6.2fs (%6.2fs elapsed)\n",
709 TICK_TO_DBL(RP_tot_time), TICK_TO_DBL(RPe_tot_time));
710 if (RtsFlags.ProfFlags.doHeapProfile == HEAP_BY_LDV)
711 fprintf(sf, " LDV time %6.2fs (%6.2fs elapsed)\n",
712 TICK_TO_DBL(LDV_tot_time), TICK_TO_DBL(LDVe_tot_time));
714 fprintf(sf, " EXIT time %6.2fs (%6.2fs elapsed)\n",
715 TICK_TO_DBL(ExitUserTime), TICK_TO_DBL(ExitElapsedTime));
716 fprintf(sf, " Total time %6.2fs (%6.2fs elapsed)\n\n",
717 TICK_TO_DBL(time), TICK_TO_DBL(etime));
718 fprintf(sf, " %%GC time %5.1f%% (%.1f%% elapsed)\n\n",
719 TICK_TO_DBL(GC_tot_time)*100/TICK_TO_DBL(time),
720 TICK_TO_DBL(GCe_tot_time)*100/TICK_TO_DBL(etime));
722 if (time - GC_tot_time - PROF_VAL(RP_tot_time - LDV_tot_time) == 0)
723 ullong_format_string(0, temp, rtsTrue/*commas*/);
725 ullong_format_string(
726 (ullong)((GC_tot_alloc*sizeof(W_))/
727 TICK_TO_DBL(time - GC_tot_time -
728 PROF_VAL(RP_tot_time - LDV_tot_time))),
729 temp, rtsTrue/*commas*/);
731 fprintf(sf, " Alloc rate %s bytes per MUT second\n\n", temp);
733 fprintf(sf, " Productivity %5.1f%% of total user, %.1f%% of total elapsed\n\n",
734 TICK_TO_DBL(time - GC_tot_time -
735 PROF_VAL(RP_tot_time - LDV_tot_time) - InitUserTime) * 100
737 TICK_TO_DBL(time - GC_tot_time -
738 PROF_VAL(RP_tot_time - LDV_tot_time) - InitUserTime) * 100
739 / TICK_TO_DBL(etime));
742 if (RtsFlags.GcFlags.giveStats == ONELINE_GC_STATS && sf != NULL) {
743 /* print the long long separately to avoid bugginess on mingwin (2001-07-02, mingw-0.5) */
744 fprintf(sf, "<<ghc: %llu bytes, ", GC_tot_alloc*sizeof(W_));
745 fprintf(sf, "%d GCs, %ld/%ld avg/max bytes residency (%ld samples), %luM in use, %.2f INIT (%.2f elapsed), %.2f MUT (%.2f elapsed), %.2f GC (%.2f elapsed) :ghc>>\n",
747 AvgResidency*sizeof(W_)/ResidencySamples,
748 MaxResidency*sizeof(W_),
750 (unsigned long)(mblocks_allocated * MBLOCK_SIZE / (1024L * 1024L)),
751 TICK_TO_DBL(InitUserTime), TICK_TO_DBL(InitElapsedTime),
752 TICK_TO_DBL(MutUserTime), TICK_TO_DBL(MutElapsedTime),
753 TICK_TO_DBL(GC_tot_time), TICK_TO_DBL(GCe_tot_time));
761 /* -----------------------------------------------------------------------------
764 Produce some detailed info on the state of the generational GC.
765 -------------------------------------------------------------------------- */
768 statDescribeGens(void)
770 nat g, s, mut, mut_once, lge, live;
775 fprintf(stderr, " Gen Steps Max Mutable Mut-Once Step Blocks Live Large\n Blocks Closures Closures Objects\n");
777 for (g = 0; g < RtsFlags.GcFlags.generations; g++) {
778 for (m = generations[g].mut_list, mut = 0; m != END_MUT_LIST;
781 for (m = generations[g].mut_once_list, mut_once = 0; m != END_MUT_LIST;
784 fprintf(stderr, "%8d %8d %8d %9d %9d", g, generations[g].n_steps,
785 generations[g].max_blocks, mut, mut_once);
787 for (s = 0; s < generations[g].n_steps; s++) {
788 step = &generations[g].steps[s];
789 for (bd = step->large_objects, lge = 0; bd; bd = bd->link)
792 if (RtsFlags.GcFlags.generations == 1) {
793 bd = step->to_blocks;
797 for (; bd; bd = bd->link) {
798 live += (bd->free - bd->start) * sizeof(W_);
801 fprintf(stderr,"%46s","");
803 fprintf(stderr,"%6d %8d %8d %8d\n", s, step->n_blocks,
807 fprintf(stderr,"\n");
811 /* -----------------------------------------------------------------------------
812 Stats available via a programmatic interface, so eg. GHCi can time
813 each compilation and expression evaluation.
814 -------------------------------------------------------------------------- */
816 extern HsInt getAllocations( void )
817 { return (HsInt)(total_allocated * sizeof(W_)); }