1 /* -----------------------------------------------------------------------------
2 * $Id: Stats.c,v 1.44 2002/02/06 01:21:40 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 HC_start_time, HC_tot_time = 0; // heap census prof user time
105 static TICK_TYPE HCe_start_time, HCe_tot_time = 0; // heap census 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 + HC_tot_time));
234 mut_user_time( void )
237 return TICK_TO_DBL(CurrentUserTime - GC_tot_time - PROF_VAL(RP_tot_time + HC_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_HC();
247 mut_user_time_during_RP( void )
249 return TICK_TO_DBL(RP_start_time - GC_tot_time - RP_tot_time - HC_tot_time);
253 mut_user_time_during_heap_census( void )
255 return TICK_TO_DBL(HC_start_time - GC_tot_time - RP_tot_time - HC_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 -
358 PROF_VAL(RPe_tot_time + HCe_tot_time) - InitElapsedStamp;
359 if (MutElapsedTime < 0) { MutElapsedTime = 0; } /* sometimes -0.00 */
361 /* for SMP, we don't know the mutator time yet, we have to inspect
362 * all the running threads to find out, and they haven't stopped
363 * yet. So we just timestamp MutUserTime at this point so we can
364 * calculate the EXIT time. The real MutUserTime is calculated
365 * in stat_exit below.
368 MutUserTime = CurrentUserTime;
370 MutUserTime = CurrentUserTime - GC_tot_time - PROF_VAL(RP_tot_time + HC_tot_time) - InitUserTime;
371 if (MutUserTime < 0) { MutUserTime = 0; }
380 ExitUserTime = CurrentUserTime - MutUserTime;
382 ExitUserTime = CurrentUserTime - MutUserTime - GC_tot_time - PROF_VAL(RP_tot_time + HC_tot_time) - InitUserTime;
384 ExitElapsedTime = CurrentElapsedTime - MutElapsedStamp;
385 if (ExitUserTime < 0) {
388 if (ExitElapsedTime < 0) {
393 /* -----------------------------------------------------------------------------
394 Called at the beginning of each GC
395 -------------------------------------------------------------------------- */
397 static nat rub_bell = 0;
399 /* initialise global variables needed during GC
401 * * GC_start_time is read in mut_user_time_during_GC(), which in turn is
402 * needed if either PROFILING or DEBUGing is enabled
407 nat bell = RtsFlags.GcFlags.ringBell;
411 fprintf(stderr, " GC ");
414 fprintf(stderr, "\007");
418 #if defined(PROFILING) || defined(DEBUG)
420 GC_start_time = CurrentUserTime; /* needed in mut_user_time_during_GC() */
423 if (RtsFlags.GcFlags.giveStats != NO_GC_STATS) {
424 #if !defined(PROFILING) && !defined(DEBUG)
426 GC_start_time = CurrentUserTime;
428 GCe_start_time = CurrentElapsedTime;
429 if (RtsFlags.GcFlags.giveStats) {
430 GC_start_faults = pageFaults();
435 /* -----------------------------------------------------------------------------
436 Called at the end of each GC
437 -------------------------------------------------------------------------- */
440 stat_endGC(lnat alloc, lnat collect, lnat live, lnat copied, lnat gen)
442 FILE *sf = RtsFlags.GcFlags.statsFile;
444 if (RtsFlags.GcFlags.giveStats != NO_GC_STATS) {
445 TICK_TYPE time, etime, gc_time, gc_etime;
448 time = CurrentUserTime;
449 etime = CurrentElapsedTime;
450 gc_time = time - GC_start_time;
451 gc_etime = etime - GCe_start_time;
453 if (RtsFlags.GcFlags.giveStats == VERBOSE_GC_STATS && sf != NULL) {
454 nat faults = pageFaults();
456 fprintf(sf, "%9ld %9ld %9ld",
457 alloc*sizeof(W_), collect*sizeof(W_), live*sizeof(W_));
458 fprintf(sf, " %5.2f %5.2f %7.2f %7.2f %4ld %4ld (Gen: %2ld)\n",
459 TICK_TO_DBL(gc_time),
460 TICK_TO_DBL(gc_etime),
462 TICK_TO_DBL(etime - ElapsedTimeStart),
463 faults - GC_start_faults,
464 GC_start_faults - GC_end_faults,
467 GC_end_faults = faults;
471 GC_coll_times[gen] += gc_time;
473 GC_tot_copied += (ullong) copied;
474 GC_tot_alloc += (ullong) alloc;
475 GC_tot_time += gc_time;
476 GCe_tot_time += gc_etime;
481 pthread_t me = pthread_self();
483 for (i = 0; i < RtsFlags.ParFlags.nNodes; i++) {
484 if (me == task_ids[i].id) {
485 task_ids[i].gc_time += gc_time;
486 task_ids[i].gc_etime += gc_etime;
493 if (gen == RtsFlags.GcFlags.generations-1) { /* major GC? */
494 if (live > MaxResidency) {
498 AvgResidency += live;
503 fprintf(stderr, "\b\b\b \b\b\b");
508 /* -----------------------------------------------------------------------------
509 Called at the beginning of each Retainer Profiliing
510 -------------------------------------------------------------------------- */
516 RP_start_time = CurrentUserTime;
517 RPe_start_time = CurrentElapsedTime;
519 #endif /* PROFILING */
521 /* -----------------------------------------------------------------------------
522 Called at the end of each Retainer Profiliing
523 -------------------------------------------------------------------------- */
528 nat retainerGeneration,
529 #ifdef DEBUG_RETAINER
533 double averageNumVisit)
536 RP_tot_time += CurrentUserTime - RP_start_time;
537 RPe_tot_time += CurrentElapsedTime - RPe_start_time;
539 fprintf(prof_file, "Retainer Profiling: %d, at %f seconds\n",
540 retainerGeneration, mut_user_time_during_RP());
541 #ifdef DEBUG_RETAINER
542 fprintf(prof_file, "\tMax C stack size = %u\n", maxCStackSize);
543 fprintf(prof_file, "\tMax auxiliary stack size = %u\n", maxStackSize);
545 fprintf(prof_file, "\tAverage number of visits per object = %f\n", averageNumVisit);
547 #endif /* PROFILING */
549 /* -----------------------------------------------------------------------------
550 Called at the beginning of each heap census
551 -------------------------------------------------------------------------- */
554 stat_startHeapCensus(void)
557 HC_start_time = CurrentUserTime;
558 HCe_start_time = CurrentElapsedTime;
560 #endif /* PROFILING */
562 /* -----------------------------------------------------------------------------
563 Called at the end of each heap census
564 -------------------------------------------------------------------------- */
567 stat_endHeapCensus(void)
570 HC_tot_time += CurrentUserTime - HC_start_time;
571 HCe_tot_time += CurrentElapsedTime - HCe_start_time;
573 #endif /* PROFILING */
575 /* -----------------------------------------------------------------------------
578 Called under SMP when a worker thread finishes. We drop the timing
579 stats for this thread into the task_ids struct for that thread.
580 -------------------------------------------------------------------------- */
584 stat_workerStop(void)
587 pthread_t me = pthread_self();
591 for (i = 0; i < RtsFlags.ParFlags.nNodes; i++) {
592 if (task_ids[i].id == me) {
593 task_ids[i].mut_time = CurrentUserTime - task_ids[i].gc_time;
594 task_ids[i].mut_etime = CurrentElapsedTime
596 - task_ids[i].elapsedtimestart;
597 if (task_ids[i].mut_time < 0.0) { task_ids[i].mut_time = 0.0; }
598 if (task_ids[i].mut_etime < 0.0) { task_ids[i].mut_etime = 0.0; }
605 long int stat_getElapsedTime ()
608 return CurrentElapsedTime;
612 /* -----------------------------------------------------------------------------
613 Called at the end of execution
615 NOTE: number of allocations is not entirely accurate: it doesn't
616 take into account the few bytes at the end of the heap that
617 were left unused when the heap-check failed.
618 -------------------------------------------------------------------------- */
623 FILE *sf = RtsFlags.GcFlags.statsFile;
625 if (RtsFlags.GcFlags.giveStats != NO_GC_STATS) {
627 char temp[BIG_STRING_LEN];
630 nat g, total_collections = 0;
633 time = CurrentUserTime;
634 etime = CurrentElapsedTime - ElapsedTimeStart;
636 GC_tot_alloc += alloc;
638 /* avoid divide by zero if time is measured as 0.00 seconds -- SDM */
639 if (time == 0.0) time = 1;
640 if (etime == 0.0) etime = 1;
642 /* Count total garbage collections */
643 for (g = 0; g < RtsFlags.GcFlags.generations; g++)
644 total_collections += generations[g].collections;
646 /* For SMP, we have to get the user time from each thread
647 * and try to work out the total time.
652 for (i = 0; i < RtsFlags.ParFlags.nNodes; i++) {
653 MutUserTime += task_ids[i].mut_time;
656 time = MutUserTime + GC_tot_time + InitUserTime + ExitUserTime;
657 if (MutUserTime < 0) { MutUserTime = 0; }
660 if (RtsFlags.GcFlags.giveStats >= VERBOSE_GC_STATS && sf != NULL) {
661 fprintf(sf, "%9ld %9.9s %9.9s", (lnat)alloc*sizeof(W_), "", "");
662 fprintf(sf, " %5.2f %5.2f\n\n", 0.0, 0.0);
665 if (RtsFlags.GcFlags.giveStats >= SUMMARY_GC_STATS && sf != NULL) {
666 ullong_format_string(GC_tot_alloc*sizeof(W_),
667 temp, rtsTrue/*commas*/);
668 fprintf(sf, "%11s bytes allocated in the heap\n", temp);
670 ullong_format_string(GC_tot_copied*sizeof(W_),
671 temp, rtsTrue/*commas*/);
672 fprintf(sf, "%11s bytes copied during GC\n", temp);
674 if ( ResidencySamples > 0 ) {
675 ullong_format_string(MaxResidency*sizeof(W_),
676 temp, rtsTrue/*commas*/);
677 fprintf(sf, "%11s bytes maximum residency (%ld sample(s))\n",
678 temp, ResidencySamples);
682 /* Print garbage collections in each gen */
683 for (g = 0; g < RtsFlags.GcFlags.generations; g++) {
684 fprintf(sf, "%11d collections in generation %d (%6.2fs)\n",
685 generations[g].collections, g,
686 TICK_TO_DBL(GC_coll_times[g]));
689 fprintf(sf,"\n%11ld Mb total memory in use\n\n",
690 mblocks_allocated * MBLOCK_SIZE / (1024 * 1024));
695 for (i = 0; i < RtsFlags.ParFlags.nNodes; i++) {
696 fprintf(sf, " Task %2d: MUT time: %6.2fs (%6.2fs elapsed)\n"
697 " GC time: %6.2fs (%6.2fs elapsed)\n\n",
699 TICK_TO_DBL(task_ids[i].mut_time),
700 TICK_TO_DBL(task_ids[i].mut_etime),
701 TICK_TO_DBL(task_ids[i].gc_time),
702 TICK_TO_DBL(task_ids[i].gc_etime));
707 fprintf(sf, " INIT time %6.2fs (%6.2fs elapsed)\n",
708 TICK_TO_DBL(InitUserTime), TICK_TO_DBL(InitElapsedTime));
709 fprintf(sf, " MUT time %6.2fs (%6.2fs elapsed)\n",
710 TICK_TO_DBL(MutUserTime), TICK_TO_DBL(MutElapsedTime));
711 fprintf(sf, " GC time %6.2fs (%6.2fs elapsed)\n",
712 TICK_TO_DBL(GC_tot_time), TICK_TO_DBL(GCe_tot_time));
714 fprintf(sf, " RP time %6.2fs (%6.2fs elapsed)\n",
715 TICK_TO_DBL(RP_tot_time), TICK_TO_DBL(RPe_tot_time));
716 fprintf(sf, " PROF time %6.2fs (%6.2fs elapsed)\n",
717 TICK_TO_DBL(HC_tot_time), TICK_TO_DBL(HCe_tot_time));
719 fprintf(sf, " EXIT time %6.2fs (%6.2fs elapsed)\n",
720 TICK_TO_DBL(ExitUserTime), TICK_TO_DBL(ExitElapsedTime));
721 fprintf(sf, " Total time %6.2fs (%6.2fs elapsed)\n\n",
722 TICK_TO_DBL(time), TICK_TO_DBL(etime));
723 fprintf(sf, " %%GC time %5.1f%% (%.1f%% elapsed)\n\n",
724 TICK_TO_DBL(GC_tot_time)*100/TICK_TO_DBL(time),
725 TICK_TO_DBL(GCe_tot_time)*100/TICK_TO_DBL(etime));
727 if (time - GC_tot_time - PROF_VAL(RP_tot_time + HC_tot_time) == 0)
728 ullong_format_string(0, temp, rtsTrue/*commas*/);
730 ullong_format_string(
731 (ullong)((GC_tot_alloc*sizeof(W_))/
732 TICK_TO_DBL(time - GC_tot_time -
733 PROF_VAL(RP_tot_time + HC_tot_time))),
734 temp, rtsTrue/*commas*/);
736 fprintf(sf, " Alloc rate %s bytes per MUT second\n\n", temp);
738 fprintf(sf, " Productivity %5.1f%% of total user, %.1f%% of total elapsed\n\n",
739 TICK_TO_DBL(time - GC_tot_time -
740 PROF_VAL(RP_tot_time + HC_tot_time) - InitUserTime) * 100
742 TICK_TO_DBL(time - GC_tot_time -
743 PROF_VAL(RP_tot_time + HC_tot_time) - InitUserTime) * 100
744 / TICK_TO_DBL(etime));
747 if (RtsFlags.GcFlags.giveStats == ONELINE_GC_STATS && sf != NULL) {
748 /* print the long long separately to avoid bugginess on mingwin (2001-07-02, mingw-0.5) */
749 fprintf(sf, "<<ghc: %llu bytes, ", GC_tot_alloc*sizeof(W_));
750 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",
752 AvgResidency*sizeof(W_)/ResidencySamples,
753 MaxResidency*sizeof(W_),
755 (unsigned long)(mblocks_allocated * MBLOCK_SIZE / (1024L * 1024L)),
756 TICK_TO_DBL(InitUserTime), TICK_TO_DBL(InitElapsedTime),
757 TICK_TO_DBL(MutUserTime), TICK_TO_DBL(MutElapsedTime),
758 TICK_TO_DBL(GC_tot_time), TICK_TO_DBL(GCe_tot_time));
768 /* -----------------------------------------------------------------------------
771 Produce some detailed info on the state of the generational GC.
772 -------------------------------------------------------------------------- */
775 statDescribeGens(void)
777 nat g, s, mut, mut_once, lge, live;
782 fprintf(stderr, " Gen Steps Max Mutable Mut-Once Step Blocks Live Large\n Blocks Closures Closures Objects\n");
784 for (g = 0; g < RtsFlags.GcFlags.generations; g++) {
785 for (m = generations[g].mut_list, mut = 0; m != END_MUT_LIST;
788 for (m = generations[g].mut_once_list, mut_once = 0; m != END_MUT_LIST;
791 fprintf(stderr, "%8d %8d %8d %9d %9d", g, generations[g].n_steps,
792 generations[g].max_blocks, mut, mut_once);
794 for (s = 0; s < generations[g].n_steps; s++) {
795 step = &generations[g].steps[s];
796 for (bd = step->large_objects, lge = 0; bd; bd = bd->link)
799 if (RtsFlags.GcFlags.generations == 1) {
800 bd = step->to_blocks;
804 for (; bd; bd = bd->link) {
805 live += (bd->free - bd->start) * sizeof(W_);
808 fprintf(stderr,"%46s","");
810 fprintf(stderr,"%6d %8d %8d %8d\n", s, step->n_blocks,
814 fprintf(stderr,"\n");
818 /* -----------------------------------------------------------------------------
819 Stats available via a programmatic interface, so eg. GHCi can time
820 each compilation and expression evaluation.
821 -------------------------------------------------------------------------- */
823 extern HsInt getAllocations( void )
824 { return (HsInt)(total_allocated * sizeof(W_)); }