1 /* -----------------------------------------------------------------------------
3 * (c) The GHC Team, 1998-2003
5 * Support for heap profiling
7 * ---------------------------------------------------------------------------*/
9 #if defined(DEBUG) && !defined(PROFILING)
10 #define DEBUG_HEAP_PROF
12 #undef DEBUG_HEAP_PROF
15 #if defined(PROFILING) || defined(DEBUG_HEAP_PROF)
17 #include "PosixSource.h"
21 #include "Profiling.h"
27 #include "RetainerProfile.h"
28 #include "LdvProfile.h"
36 /* -----------------------------------------------------------------------------
37 * era stores the current time period. It is the same as the
38 * number of censuses that have been performed.
41 * era must be no longer than LDV_SHIFT (15 or 30) bits.
43 * era is initialized to 1 in initHeapProfiling().
45 * max_era is initialized to 2^LDV_SHIFT in initHeapProfiling().
46 * When era reaches max_era, the profiling stops because a closure can
47 * store only up to (max_era - 1) as its creation or last use time.
48 * -------------------------------------------------------------------------- */
52 /* -----------------------------------------------------------------------------
55 * For most heap profiles each closure identity gets a simple count
56 * of live words in the heap at each census. However, if we're
57 * selecting by biography, then we have to keep the various
58 * lag/drag/void counters for each identity.
59 * -------------------------------------------------------------------------- */
60 typedef struct _counter {
65 int prim; // total size of 'inherently used' closures
66 int not_used; // total size of 'never used' closures
67 int used; // total size of 'used at least once' closures
68 int void_total; // current total size of 'destroyed without being used' closures
69 int drag_total; // current total size of 'used at least once and waiting to die'
72 struct _counter *next;
76 initLDVCtr( counter *ctr )
79 ctr->c.ldv.not_used = 0;
81 ctr->c.ldv.void_total = 0;
82 ctr->c.ldv.drag_total = 0;
86 double time; // the time in MUT time when the census is made
91 // for LDV profiling, when just displaying by LDV
99 static Census *censuses = NULL;
100 static nat n_censuses = 0;
103 static void aggregateCensusInfo( void );
106 static void dumpCensus( Census *census );
108 /* -----------------------------------------------------------------------------
109 Closure Type Profiling;
111 PROBABLY TOTALLY OUT OF DATE -- ToDo (SDM)
112 -------------------------------------------------------------------------- */
114 #ifdef DEBUG_HEAP_PROF
115 static char *type_names[] = {
121 , "CONSTR_NOCAF_STATIC"
159 , "MUT_ARR_PTRS_FROZEN"
173 #endif /* DEBUG_HEAP_PROF */
175 /* -----------------------------------------------------------------------------
176 * Find the "closure identity", which is a unique pointer reresenting
177 * the band to which this closure's heap space is attributed in the
179 * ------------------------------------------------------------------------- */
181 closureIdentity( StgClosure *p )
183 switch (RtsFlags.ProfFlags.doHeapProfile) {
187 return p->header.prof.ccs;
189 return p->header.prof.ccs->cc->module;
191 return get_itbl(p)->prof.closure_desc;
193 return get_itbl(p)->prof.closure_type;
194 case HEAP_BY_RETAINER:
195 // AFAIK, the only closures in the heap which might not have a
196 // valid retainer set are DEAD_WEAK closures.
197 if (isRetainerSetFieldValid(p))
198 return retainerSetOf(p);
203 case HEAP_BY_INFOPTR:
204 return (void *)((StgClosure *)p)->header.info;
205 case HEAP_BY_CLOSURE_TYPE:
206 return type_names[get_itbl(p)->type];
210 barf("closureIdentity");
214 /* --------------------------------------------------------------------------
215 * Profiling type predicates
216 * ----------------------------------------------------------------------- */
218 STATIC_INLINE rtsBool
219 doingLDVProfiling( void )
221 return (RtsFlags.ProfFlags.doHeapProfile == HEAP_BY_LDV
222 || RtsFlags.ProfFlags.bioSelector != NULL);
225 STATIC_INLINE rtsBool
226 doingRetainerProfiling( void )
228 return (RtsFlags.ProfFlags.doHeapProfile == HEAP_BY_RETAINER
229 || RtsFlags.ProfFlags.retainerSelector != NULL);
233 // Precesses a closure 'c' being destroyed whose size is 'size'.
234 // Make sure that LDV_recordDead() is not invoked on 'inherently used' closures
235 // such as TSO; they should not be involved in computing dragNew or voidNew.
237 // Even though era is checked in both LdvCensusForDead() and
238 // LdvCensusKillAll(), we still need to make sure that era is > 0 because
239 // LDV_recordDead() may be called from elsewhere in the runtime system. E.g.,
240 // when a thunk is replaced by an indirection object.
244 LDV_recordDead( StgClosure *c, nat size )
250 if (era > 0 && closureSatisfiesConstraints(c)) {
251 size -= sizeofW(StgProfHeader);
252 ASSERT(LDVW(c) != 0);
253 if ((LDVW((c)) & LDV_STATE_MASK) == LDV_STATE_CREATE) {
254 t = (LDVW((c)) & LDV_CREATE_MASK) >> LDV_SHIFT;
256 if (RtsFlags.ProfFlags.bioSelector == NULL) {
257 censuses[t].void_total += (int)size;
258 censuses[era].void_total -= (int)size;
260 id = closureIdentity(c);
261 ctr = lookupHashTable(censuses[t].hash, (StgWord)id);
262 ASSERT( ctr != NULL );
263 ctr->c.ldv.void_total += (int)size;
264 ctr = lookupHashTable(censuses[era].hash, (StgWord)id);
266 ctr = arenaAlloc(censuses[era].arena, sizeof(counter));
268 insertHashTable(censuses[era].hash, (StgWord)id, ctr);
270 ctr->next = censuses[era].ctrs;
271 censuses[era].ctrs = ctr;
273 ctr->c.ldv.void_total -= (int)size;
277 t = LDVW((c)) & LDV_LAST_MASK;
279 if (RtsFlags.ProfFlags.bioSelector == NULL) {
280 censuses[t+1].drag_total += size;
281 censuses[era].drag_total -= size;
284 id = closureIdentity(c);
285 ctr = lookupHashTable(censuses[t+1].hash, (StgWord)id);
286 ASSERT( ctr != NULL );
287 ctr->c.ldv.drag_total += (int)size;
288 ctr = lookupHashTable(censuses[era].hash, (StgWord)id);
290 ctr = arenaAlloc(censuses[era].arena, sizeof(counter));
292 insertHashTable(censuses[era].hash, (StgWord)id, ctr);
294 ctr->next = censuses[era].ctrs;
295 censuses[era].ctrs = ctr;
297 ctr->c.ldv.drag_total -= (int)size;
305 /* --------------------------------------------------------------------------
306 * Initialize censuses[era];
307 * ----------------------------------------------------------------------- */
309 initEra(Census *census)
311 census->hash = allocHashTable();
313 census->arena = newArena();
315 census->not_used = 0;
318 census->void_total = 0;
319 census->drag_total = 0;
322 /* --------------------------------------------------------------------------
323 * Increases era by 1 and initialize census[era].
324 * Reallocates gi[] and increases its size if needed.
325 * ----------------------------------------------------------------------- */
330 if (doingLDVProfiling()) {
333 if (era == max_era) {
334 errorBelch("maximum number of censuses reached; use +RTS -i to reduce");
335 stg_exit(EXIT_FAILURE);
338 if (era == n_censuses) {
340 censuses = stgReallocBytes(censuses, sizeof(Census) * n_censuses,
346 initEra( &censuses[era] );
349 /* -----------------------------------------------------------------------------
350 * DEBUG heap profiling, by info table
351 * -------------------------------------------------------------------------- */
353 #ifdef DEBUG_HEAP_PROF
355 static char *hp_filename;
357 void initProfiling1( void )
361 void initProfiling2( void )
363 if (RtsFlags.ProfFlags.doHeapProfile) {
364 /* Initialise the log file name */
365 hp_filename = stgMallocBytes(strlen(prog_name) + 6, "hpFileName");
366 sprintf(hp_filename, "%s.hp", prog_name);
368 /* open the log file */
369 if ((hp_file = fopen(hp_filename, "w")) == NULL) {
370 debugBelch("Can't open profiling report file %s\n",
372 RtsFlags.ProfFlags.doHeapProfile = 0;
380 void endProfiling( void )
384 #endif /* DEBUG_HEAP_PROF */
387 printSample(rtsBool beginSample, StgDouble sampleValue)
389 StgDouble fractionalPart, integralPart;
390 fractionalPart = modf(sampleValue, &integralPart);
391 fprintf(hp_file, "%s %d.%02d\n",
392 (beginSample ? "BEGIN_SAMPLE" : "END_SAMPLE"),
393 (int)integralPart, (int)(fractionalPart * 100 + 0.5));
396 /* --------------------------------------------------------------------------
397 * Initialize the heap profilier
398 * ----------------------------------------------------------------------- */
400 initHeapProfiling(void)
402 if (! RtsFlags.ProfFlags.doHeapProfile) {
407 if (doingLDVProfiling() && doingRetainerProfiling()) {
408 errorBelch("cannot mix -hb and -hr");
413 // we only count eras if we're doing LDV profiling. Otherwise era
416 if (doingLDVProfiling()) {
424 { // max_era = 2^LDV_SHIFT
427 for (p = 0; p < LDV_SHIFT; p++)
432 censuses = stgMallocBytes(sizeof(Census) * n_censuses, "initHeapProfiling");
434 initEra( &censuses[era] );
436 /* initProfilingLogFile(); */
437 fprintf(hp_file, "JOB \"%s", prog_name);
442 for(count = 1; count < prog_argc; count++)
443 fprintf(hp_file, " %s", prog_argv[count]);
444 fprintf(hp_file, " +RTS");
445 for(count = 0; count < rts_argc; count++)
446 fprintf(hp_file, " %s", rts_argv[count]);
448 #endif /* PROFILING */
450 fprintf(hp_file, "\"\n" );
452 fprintf(hp_file, "DATE \"%s\"\n", time_str());
454 fprintf(hp_file, "SAMPLE_UNIT \"seconds\"\n");
455 fprintf(hp_file, "VALUE_UNIT \"bytes\"\n");
457 printSample(rtsTrue, 0);
458 printSample(rtsFalse, 0);
460 #ifdef DEBUG_HEAP_PROF
461 DEBUG_LoadSymbols(prog_name);
465 if (doingRetainerProfiling()) {
466 initRetainerProfiling();
474 endHeapProfiling(void)
478 if (! RtsFlags.ProfFlags.doHeapProfile) {
483 if (doingRetainerProfiling()) {
484 endRetainerProfiling();
489 if (doingLDVProfiling()) {
492 aggregateCensusInfo();
493 for (t = 1; t < era; t++) {
494 dumpCensus( &censuses[t] );
499 seconds = mut_user_time();
500 printSample(rtsTrue, seconds);
501 printSample(rtsFalse, seconds);
509 buf_append(char *p, const char *q, char *end)
513 for (m = 0; p < end; p++, q++, m++) {
515 if (*q == '\0') { break; }
521 fprint_ccs(FILE *fp, CostCentreStack *ccs, nat max_length)
523 char buf[max_length+1], *p, *buf_end;
527 // MAIN on its own gets printed as "MAIN", otherwise we ignore MAIN.
528 if (ccs == CCS_MAIN) {
533 fprintf(fp, "(%d)", ccs->ccsID);
536 buf_end = buf + max_length + 1;
538 // keep printing components of the stack until we run out of space
539 // in the buffer. If we run out of space, end with "...".
540 for (; ccs != NULL && ccs != CCS_MAIN; ccs = ccs->prevStack) {
542 // CAF cost centres print as M.CAF, but we leave the module
543 // name out of all the others to save space.
544 if (!strcmp(ccs->cc->label,"CAF")) {
545 p += buf_append(p, ccs->cc->module, buf_end);
546 p += buf_append(p, ".CAF", buf_end);
548 if (ccs->prevStack != NULL && ccs->prevStack != CCS_MAIN) {
549 p += buf_append(p, "/", buf_end);
551 p += buf_append(p, ccs->cc->label, buf_end);
555 sprintf(buf+max_length-4, "...");
558 next_offset += written;
561 fprintf(fp, "%s", buf);
566 strMatchesSelector( char* str, char* sel )
569 // debugBelch("str_matches_selector %s %s\n", str, sel);
571 // Compare str against wherever we've got to in sel.
573 while (*p != '\0' && *sel != ',' && *sel != '\0' && *p == *sel) {
576 // Match if all of str used and have reached the end of a sel fragment.
577 if (*p == '\0' && (*sel == ',' || *sel == '\0'))
580 // No match. Advance sel to the start of the next elem.
581 while (*sel != ',' && *sel != '\0') sel++;
582 if (*sel == ',') sel++;
584 /* Run out of sel ?? */
585 if (*sel == '\0') return rtsFalse;
589 /* -----------------------------------------------------------------------------
590 * Figure out whether a closure should be counted in this census, by
591 * testing against all the specified constraints.
592 * -------------------------------------------------------------------------- */
594 closureSatisfiesConstraints( StgClosure* p )
596 #ifdef DEBUG_HEAP_PROF
597 (void)p; /* keep gcc -Wall happy */
602 // The CCS has a selected field to indicate whether this closure is
603 // deselected by not being mentioned in the module, CC, or CCS
605 if (!p->header.prof.ccs->selected) {
609 if (RtsFlags.ProfFlags.descrSelector) {
610 b = strMatchesSelector( (get_itbl((StgClosure *)p))->prof.closure_desc,
611 RtsFlags.ProfFlags.descrSelector );
612 if (!b) return rtsFalse;
614 if (RtsFlags.ProfFlags.typeSelector) {
615 b = strMatchesSelector( (get_itbl((StgClosure *)p))->prof.closure_type,
616 RtsFlags.ProfFlags.typeSelector );
617 if (!b) return rtsFalse;
619 if (RtsFlags.ProfFlags.retainerSelector) {
622 // We must check that the retainer set is valid here. One
623 // reason it might not be valid is if this closure is a
624 // a newly deceased weak pointer (i.e. a DEAD_WEAK), since
625 // these aren't reached by the retainer profiler's traversal.
626 if (isRetainerSetFieldValid((StgClosure *)p)) {
627 rs = retainerSetOf((StgClosure *)p);
629 for (i = 0; i < rs->num; i++) {
630 b = strMatchesSelector( rs->element[i]->cc->label,
631 RtsFlags.ProfFlags.retainerSelector );
632 if (b) return rtsTrue;
639 #endif /* PROFILING */
642 /* -----------------------------------------------------------------------------
643 * Aggregate the heap census info for biographical profiling
644 * -------------------------------------------------------------------------- */
647 aggregateCensusInfo( void )
651 counter *c, *d, *ctrs;
654 if (!doingLDVProfiling()) return;
656 // Aggregate the LDV counters when displaying by biography.
657 if (RtsFlags.ProfFlags.doHeapProfile == HEAP_BY_LDV) {
658 int void_total, drag_total;
660 // Now we compute void_total and drag_total for each census
663 for (t = 1; t < era; t++) { // note: start at 1, not 0
664 void_total += censuses[t].void_total;
665 drag_total += censuses[t].drag_total;
666 censuses[t].void_total = void_total;
667 censuses[t].drag_total = drag_total;
668 ASSERT( censuses[t].void_total <= censuses[t].not_used );
669 ASSERT( censuses[t].drag_total <= censuses[t].used );
675 // otherwise... we're doing a heap profile that is restricted to
676 // some combination of lag, drag, void or use. We've kept all the
677 // census info for all censuses so far, but we still need to
678 // aggregate the counters forwards.
681 acc = allocHashTable();
684 for (t = 1; t < era; t++) {
686 // first look through all the counters we're aggregating
687 for (c = ctrs; c != NULL; c = c->next) {
688 // if one of the totals is non-zero, then this closure
689 // type must be present in the heap at this census time...
690 d = lookupHashTable(censuses[t].hash, (StgWord)c->identity);
693 // if this closure identity isn't present in the
694 // census for this time period, then our running
695 // totals *must* be zero.
696 ASSERT(c->c.ldv.void_total == 0 && c->c.ldv.drag_total == 0);
698 // debugCCS(c->identity);
699 // debugBelch(" census=%d void_total=%d drag_total=%d\n",
700 // t, c->c.ldv.void_total, c->c.ldv.drag_total);
702 d->c.ldv.void_total += c->c.ldv.void_total;
703 d->c.ldv.drag_total += c->c.ldv.drag_total;
704 c->c.ldv.void_total = d->c.ldv.void_total;
705 c->c.ldv.drag_total = d->c.ldv.drag_total;
707 ASSERT( c->c.ldv.void_total >= 0 );
708 ASSERT( c->c.ldv.drag_total >= 0 );
712 // now look through the counters in this census to find new ones
713 for (c = censuses[t].ctrs; c != NULL; c = c->next) {
714 d = lookupHashTable(acc, (StgWord)c->identity);
716 d = arenaAlloc( arena, sizeof(counter) );
718 insertHashTable( acc, (StgWord)c->identity, d );
719 d->identity = c->identity;
722 d->c.ldv.void_total = c->c.ldv.void_total;
723 d->c.ldv.drag_total = c->c.ldv.drag_total;
725 ASSERT( c->c.ldv.void_total >= 0 );
726 ASSERT( c->c.ldv.drag_total >= 0 );
730 freeHashTable(acc, NULL);
735 /* -----------------------------------------------------------------------------
736 * Print out the results of a heap census.
737 * -------------------------------------------------------------------------- */
739 dumpCensus( Census *census )
744 printSample(rtsTrue, census->time);
747 if (RtsFlags.ProfFlags.doHeapProfile == HEAP_BY_LDV) {
748 fprintf(hp_file, "VOID\t%u\n", census->void_total * sizeof(W_));
749 fprintf(hp_file, "LAG\t%u\n",
750 (census->not_used - census->void_total) * sizeof(W_));
751 fprintf(hp_file, "USE\t%u\n",
752 (census->used - census->drag_total) * sizeof(W_));
753 fprintf(hp_file, "INHERENT_USE\t%u\n",
754 census->prim * sizeof(W_));
755 fprintf(hp_file, "DRAG\t%u\n", census->drag_total *
757 printSample(rtsFalse, census->time);
762 for (ctr = census->ctrs; ctr != NULL; ctr = ctr->next) {
765 if (RtsFlags.ProfFlags.bioSelector != NULL) {
767 if (strMatchesSelector("lag", RtsFlags.ProfFlags.bioSelector))
768 count += ctr->c.ldv.not_used - ctr->c.ldv.void_total;
769 if (strMatchesSelector("drag", RtsFlags.ProfFlags.bioSelector))
770 count += ctr->c.ldv.drag_total;
771 if (strMatchesSelector("void", RtsFlags.ProfFlags.bioSelector))
772 count += ctr->c.ldv.void_total;
773 if (strMatchesSelector("use", RtsFlags.ProfFlags.bioSelector))
774 count += ctr->c.ldv.used - ctr->c.ldv.drag_total;
778 count = ctr->c.resid;
781 ASSERT( count >= 0 );
783 if (count == 0) continue;
785 #ifdef DEBUG_HEAP_PROF
786 switch (RtsFlags.ProfFlags.doHeapProfile) {
787 case HEAP_BY_INFOPTR:
788 fprintf(hp_file, "%s", lookupGHCName(ctr->identity));
790 case HEAP_BY_CLOSURE_TYPE:
791 fprintf(hp_file, "%s", (char *)ctr->identity);
797 switch (RtsFlags.ProfFlags.doHeapProfile) {
799 fprint_ccs(hp_file, (CostCentreStack *)ctr->identity, 25);
804 fprintf(hp_file, "%s", (char *)ctr->identity);
806 case HEAP_BY_RETAINER:
808 RetainerSet *rs = (RetainerSet *)ctr->identity;
810 // it might be the distinguished retainer set rs_MANY:
811 if (rs == &rs_MANY) {
812 fprintf(hp_file, "MANY");
816 // Mark this retainer set by negating its id, because it
817 // has appeared in at least one census. We print the
818 // values of all such retainer sets into the log file at
819 // the end. A retainer set may exist but not feature in
820 // any censuses if it arose as the intermediate retainer
821 // set for some closure during retainer set calculation.
825 // report in the unit of bytes: * sizeof(StgWord)
826 printRetainerSetShort(hp_file, rs);
830 barf("dumpCensus; doHeapProfile");
834 fprintf(hp_file, "\t%d\n", count * sizeof(W_));
837 printSample(rtsFalse, census->time);
840 /* -----------------------------------------------------------------------------
841 * Code to perform a heap census.
842 * -------------------------------------------------------------------------- */
844 heapCensusChain( Census *census, bdescr *bd )
854 for (; bd != NULL; bd = bd->link) {
856 // HACK: ignore pinned blocks, because they contain gaps.
857 // It's not clear exactly what we'd like to do here, since we
858 // can't tell which objects in the block are actually alive.
859 // Perhaps the whole block should be counted as SYSTEM memory.
860 if (bd->flags & BF_PINNED) {
865 while (p < bd->free) {
866 info = get_itbl((StgClosure *)p);
869 switch (info->type) {
876 case IND_OLDGEN_PERM:
878 case SE_CAF_BLACKHOLE:
883 case CONSTR_CHARLIKE:
897 size = sizeW_fromITBL(info);
902 size = bco_sizeW((StgBCO *)p);
911 size = sizeW_fromITBL(info);
914 case THUNK_1_0: /* ToDo - shouldn't be here */
915 case THUNK_0_1: /* " ditto " */
917 size = sizeofW(StgHeader) + MIN_UPD_SIZE;
922 size = pap_sizeW((StgPAP *)p);
926 size = ap_stack_sizeW((StgAP_STACK *)p);
931 size = arr_words_sizeW(stgCast(StgArrWords*,p));
935 case MUT_ARR_PTRS_FROZEN:
937 size = mut_arr_ptrs_sizeW((StgMutArrPtrs *)p);
942 #ifdef DEBUG_HEAP_PROF
943 size = tso_sizeW((StgTSO *)p);
946 if (RtsFlags.ProfFlags.includeTSOs) {
947 size = tso_sizeW((StgTSO *)p);
950 // Skip this TSO and move on to the next object
951 p += tso_sizeW((StgTSO *)p);
962 #ifdef DEBUG_HEAP_PROF
965 // subtract the profiling overhead
966 real_size = size - sizeofW(StgProfHeader);
969 if (closureSatisfiesConstraints((StgClosure*)p)) {
971 if (RtsFlags.ProfFlags.doHeapProfile == HEAP_BY_LDV) {
973 census->prim += real_size;
974 else if ((LDVW(p) & LDV_STATE_MASK) == LDV_STATE_CREATE)
975 census->not_used += real_size;
977 census->used += real_size;
981 identity = closureIdentity((StgClosure *)p);
983 if (identity != NULL) {
984 ctr = lookupHashTable( census->hash, (StgWord)identity );
987 if (RtsFlags.ProfFlags.bioSelector != NULL) {
989 ctr->c.ldv.prim += real_size;
990 else if ((LDVW(p) & LDV_STATE_MASK) == LDV_STATE_CREATE)
991 ctr->c.ldv.not_used += real_size;
993 ctr->c.ldv.used += real_size;
997 ctr->c.resid += real_size;
1000 ctr = arenaAlloc( census->arena, sizeof(counter) );
1002 insertHashTable( census->hash, (StgWord)identity, ctr );
1003 ctr->identity = identity;
1004 ctr->next = census->ctrs;
1008 if (RtsFlags.ProfFlags.bioSelector != NULL) {
1010 ctr->c.ldv.prim = real_size;
1011 else if ((LDVW(p) & LDV_STATE_MASK) == LDV_STATE_CREATE)
1012 ctr->c.ldv.not_used = real_size;
1014 ctr->c.ldv.used = real_size;
1018 ctr->c.resid = real_size;
1036 census = &censuses[era];
1037 census->time = mut_user_time();
1039 // calculate retainer sets if necessary
1041 if (doingRetainerProfiling()) {
1047 stat_startHeapCensus();
1050 // Traverse the heap, collecting the census info
1052 // First the small_alloc_list: we have to fix the free pointer at
1053 // the end by calling tidyAllocatedLists() first.
1054 tidyAllocateLists();
1055 heapCensusChain( census, small_alloc_list );
1057 // Now traverse the heap in each generation/step.
1058 if (RtsFlags.GcFlags.generations == 1) {
1059 heapCensusChain( census, g0s0->to_blocks );
1061 for (g = 0; g < RtsFlags.GcFlags.generations; g++) {
1062 for (s = 0; s < generations[g].n_steps; s++) {
1063 heapCensusChain( census, generations[g].steps[s].blocks );
1064 // Are we interested in large objects? might be
1065 // confusing to include the stack in a heap profile.
1066 heapCensusChain( census, generations[g].steps[s].large_objects );
1071 // dump out the census info
1073 // We can't generate any info for LDV profiling until
1074 // the end of the run...
1075 if (!doingLDVProfiling())
1076 dumpCensus( census );
1078 dumpCensus( census );
1082 // free our storage, unless we're keeping all the census info for
1083 // future restriction by biography.
1085 if (RtsFlags.ProfFlags.bioSelector == NULL)
1088 freeHashTable( census->hash, NULL/* don't free the elements */ );
1089 arenaFree( census->arena );
1090 census->hash = NULL;
1091 census->arena = NULL;
1094 // we're into the next time period now
1098 stat_endHeapCensus();
1102 #endif /* PROFILING || DEBUG_HEAP_PROF */