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"
158 , "MUT_ARR_PTRS_FROZEN"
172 #endif /* DEBUG_HEAP_PROF */
174 /* -----------------------------------------------------------------------------
175 * Find the "closure identity", which is a unique pointer reresenting
176 * the band to which this closure's heap space is attributed in the
178 * ------------------------------------------------------------------------- */
180 closureIdentity( StgClosure *p )
182 switch (RtsFlags.ProfFlags.doHeapProfile) {
186 return p->header.prof.ccs;
188 return p->header.prof.ccs->cc->module;
190 return get_itbl(p)->prof.closure_desc;
192 return get_itbl(p)->prof.closure_type;
193 case HEAP_BY_RETAINER:
194 // AFAIK, the only closures in the heap which might not have a
195 // valid retainer set are DEAD_WEAK closures.
196 if (isRetainerSetFieldValid(p))
197 return retainerSetOf(p);
202 case HEAP_BY_INFOPTR:
203 return (void *)((StgClosure *)p)->header.info;
204 case HEAP_BY_CLOSURE_TYPE:
205 return type_names[get_itbl(p)->type];
209 barf("closureIdentity");
213 /* --------------------------------------------------------------------------
214 * Profiling type predicates
215 * ----------------------------------------------------------------------- */
217 STATIC_INLINE rtsBool
218 doingLDVProfiling( void )
220 return (RtsFlags.ProfFlags.doHeapProfile == HEAP_BY_LDV
221 || RtsFlags.ProfFlags.bioSelector != NULL);
224 STATIC_INLINE rtsBool
225 doingRetainerProfiling( void )
227 return (RtsFlags.ProfFlags.doHeapProfile == HEAP_BY_RETAINER
228 || RtsFlags.ProfFlags.retainerSelector != NULL);
230 #endif /* PROFILING */
232 // Precesses a closure 'c' being destroyed whose size is 'size'.
233 // Make sure that LDV_recordDead() is not invoked on 'inherently used' closures
234 // such as TSO; they should not be involved in computing dragNew or voidNew.
236 // Even though era is checked in both LdvCensusForDead() and
237 // LdvCensusKillAll(), we still need to make sure that era is > 0 because
238 // LDV_recordDead() may be called from elsewhere in the runtime system. E.g.,
239 // when a thunk is replaced by an indirection object.
243 LDV_recordDead( StgClosure *c, nat size )
249 if (era > 0 && closureSatisfiesConstraints(c)) {
250 size -= sizeofW(StgProfHeader);
251 ASSERT(LDVW(c) != 0);
252 if ((LDVW((c)) & LDV_STATE_MASK) == LDV_STATE_CREATE) {
253 t = (LDVW((c)) & LDV_CREATE_MASK) >> LDV_SHIFT;
255 if (RtsFlags.ProfFlags.bioSelector == NULL) {
256 censuses[t].void_total += (int)size;
257 censuses[era].void_total -= (int)size;
259 id = closureIdentity(c);
260 ctr = lookupHashTable(censuses[t].hash, (StgWord)id);
261 ASSERT( ctr != NULL );
262 ctr->c.ldv.void_total += (int)size;
263 ctr = lookupHashTable(censuses[era].hash, (StgWord)id);
265 ctr = arenaAlloc(censuses[era].arena, sizeof(counter));
267 insertHashTable(censuses[era].hash, (StgWord)id, ctr);
269 ctr->next = censuses[era].ctrs;
270 censuses[era].ctrs = ctr;
272 ctr->c.ldv.void_total -= (int)size;
276 t = LDVW((c)) & LDV_LAST_MASK;
278 if (RtsFlags.ProfFlags.bioSelector == NULL) {
279 censuses[t+1].drag_total += size;
280 censuses[era].drag_total -= size;
283 id = closureIdentity(c);
284 ctr = lookupHashTable(censuses[t+1].hash, (StgWord)id);
285 ASSERT( ctr != NULL );
286 ctr->c.ldv.drag_total += (int)size;
287 ctr = lookupHashTable(censuses[era].hash, (StgWord)id);
289 ctr = arenaAlloc(censuses[era].arena, sizeof(counter));
291 insertHashTable(censuses[era].hash, (StgWord)id, ctr);
293 ctr->next = censuses[era].ctrs;
294 censuses[era].ctrs = ctr;
296 ctr->c.ldv.drag_total -= (int)size;
304 /* --------------------------------------------------------------------------
305 * Initialize censuses[era];
306 * ----------------------------------------------------------------------- */
308 initEra(Census *census)
310 census->hash = allocHashTable();
312 census->arena = newArena();
314 census->not_used = 0;
317 census->void_total = 0;
318 census->drag_total = 0;
321 /* --------------------------------------------------------------------------
322 * Increases era by 1 and initialize census[era].
323 * Reallocates gi[] and increases its size if needed.
324 * ----------------------------------------------------------------------- */
329 if (doingLDVProfiling()) {
332 if (era == max_era) {
333 errorBelch("maximum number of censuses reached; use +RTS -i to reduce");
334 stg_exit(EXIT_FAILURE);
337 if (era == n_censuses) {
339 censuses = stgReallocBytes(censuses, sizeof(Census) * n_censuses,
343 #endif /* PROFILING */
345 initEra( &censuses[era] );
348 /* -----------------------------------------------------------------------------
349 * DEBUG heap profiling, by info table
350 * -------------------------------------------------------------------------- */
352 #ifdef DEBUG_HEAP_PROF
354 static char *hp_filename;
356 void initProfiling1( void )
360 void initProfiling2( void )
362 if (RtsFlags.ProfFlags.doHeapProfile) {
363 /* Initialise the log file name */
364 hp_filename = stgMallocBytes(strlen(prog_name) + 6, "hpFileName");
365 sprintf(hp_filename, "%s.hp", prog_name);
367 /* open the log file */
368 if ((hp_file = fopen(hp_filename, "w")) == NULL) {
369 debugBelch("Can't open profiling report file %s\n",
371 RtsFlags.ProfFlags.doHeapProfile = 0;
379 void endProfiling( void )
383 #endif /* DEBUG_HEAP_PROF */
386 printSample(rtsBool beginSample, StgDouble sampleValue)
388 StgDouble fractionalPart, integralPart;
389 fractionalPart = modf(sampleValue, &integralPart);
390 fprintf(hp_file, "%s %d.%02d\n",
391 (beginSample ? "BEGIN_SAMPLE" : "END_SAMPLE"),
392 (int)integralPart, (int)(fractionalPart * 100 + 0.5));
395 /* --------------------------------------------------------------------------
396 * Initialize the heap profilier
397 * ----------------------------------------------------------------------- */
399 initHeapProfiling(void)
401 if (! RtsFlags.ProfFlags.doHeapProfile) {
406 if (doingLDVProfiling() && doingRetainerProfiling()) {
407 errorBelch("cannot mix -hb and -hr");
412 // we only count eras if we're doing LDV profiling. Otherwise era
415 if (doingLDVProfiling()) {
423 { // max_era = 2^LDV_SHIFT
426 for (p = 0; p < LDV_SHIFT; p++)
431 censuses = stgMallocBytes(sizeof(Census) * n_censuses, "initHeapProfiling");
433 initEra( &censuses[era] );
435 /* initProfilingLogFile(); */
436 fprintf(hp_file, "JOB \"%s", prog_name);
441 for(count = 1; count < prog_argc; count++)
442 fprintf(hp_file, " %s", prog_argv[count]);
443 fprintf(hp_file, " +RTS");
444 for(count = 0; count < rts_argc; count++)
445 fprintf(hp_file, " %s", rts_argv[count]);
447 #endif /* PROFILING */
449 fprintf(hp_file, "\"\n" );
451 fprintf(hp_file, "DATE \"%s\"\n", time_str());
453 fprintf(hp_file, "SAMPLE_UNIT \"seconds\"\n");
454 fprintf(hp_file, "VALUE_UNIT \"bytes\"\n");
456 printSample(rtsTrue, 0);
457 printSample(rtsFalse, 0);
459 #ifdef DEBUG_HEAP_PROF
460 DEBUG_LoadSymbols(prog_name);
464 if (doingRetainerProfiling()) {
465 initRetainerProfiling();
473 endHeapProfiling(void)
477 if (! RtsFlags.ProfFlags.doHeapProfile) {
482 if (doingRetainerProfiling()) {
483 endRetainerProfiling();
488 if (doingLDVProfiling()) {
491 aggregateCensusInfo();
492 for (t = 1; t < era; t++) {
493 dumpCensus( &censuses[t] );
498 seconds = mut_user_time();
499 printSample(rtsTrue, seconds);
500 printSample(rtsFalse, seconds);
508 buf_append(char *p, const char *q, char *end)
512 for (m = 0; p < end; p++, q++, m++) {
514 if (*q == '\0') { break; }
520 fprint_ccs(FILE *fp, CostCentreStack *ccs, nat max_length)
522 char buf[max_length+1], *p, *buf_end;
526 // MAIN on its own gets printed as "MAIN", otherwise we ignore MAIN.
527 if (ccs == CCS_MAIN) {
532 fprintf(fp, "(%ld)", ccs->ccsID);
535 buf_end = buf + max_length + 1;
537 // keep printing components of the stack until we run out of space
538 // in the buffer. If we run out of space, end with "...".
539 for (; ccs != NULL && ccs != CCS_MAIN; ccs = ccs->prevStack) {
541 // CAF cost centres print as M.CAF, but we leave the module
542 // name out of all the others to save space.
543 if (!strcmp(ccs->cc->label,"CAF")) {
544 p += buf_append(p, ccs->cc->module, buf_end);
545 p += buf_append(p, ".CAF", buf_end);
547 if (ccs->prevStack != NULL && ccs->prevStack != CCS_MAIN) {
548 p += buf_append(p, "/", buf_end);
550 p += buf_append(p, ccs->cc->label, buf_end);
554 sprintf(buf+max_length-4, "...");
557 next_offset += written;
560 fprintf(fp, "%s", buf);
562 #endif /* PROFILING */
565 strMatchesSelector( char* str, char* sel )
568 // debugBelch("str_matches_selector %s %s\n", str, sel);
570 // Compare str against wherever we've got to in sel.
572 while (*p != '\0' && *sel != ',' && *sel != '\0' && *p == *sel) {
575 // Match if all of str used and have reached the end of a sel fragment.
576 if (*p == '\0' && (*sel == ',' || *sel == '\0'))
579 // No match. Advance sel to the start of the next elem.
580 while (*sel != ',' && *sel != '\0') sel++;
581 if (*sel == ',') sel++;
583 /* Run out of sel ?? */
584 if (*sel == '\0') return rtsFalse;
588 /* -----------------------------------------------------------------------------
589 * Figure out whether a closure should be counted in this census, by
590 * testing against all the specified constraints.
591 * -------------------------------------------------------------------------- */
593 closureSatisfiesConstraints( StgClosure* p )
595 #ifdef DEBUG_HEAP_PROF
596 (void)p; /* keep gcc -Wall happy */
601 // The CCS has a selected field to indicate whether this closure is
602 // deselected by not being mentioned in the module, CC, or CCS
604 if (!p->header.prof.ccs->selected) {
608 if (RtsFlags.ProfFlags.descrSelector) {
609 b = strMatchesSelector( (get_itbl((StgClosure *)p))->prof.closure_desc,
610 RtsFlags.ProfFlags.descrSelector );
611 if (!b) return rtsFalse;
613 if (RtsFlags.ProfFlags.typeSelector) {
614 b = strMatchesSelector( (get_itbl((StgClosure *)p))->prof.closure_type,
615 RtsFlags.ProfFlags.typeSelector );
616 if (!b) return rtsFalse;
618 if (RtsFlags.ProfFlags.retainerSelector) {
621 // We must check that the retainer set is valid here. One
622 // reason it might not be valid is if this closure is a
623 // a newly deceased weak pointer (i.e. a DEAD_WEAK), since
624 // these aren't reached by the retainer profiler's traversal.
625 if (isRetainerSetFieldValid((StgClosure *)p)) {
626 rs = retainerSetOf((StgClosure *)p);
628 for (i = 0; i < rs->num; i++) {
629 b = strMatchesSelector( rs->element[i]->cc->label,
630 RtsFlags.ProfFlags.retainerSelector );
631 if (b) return rtsTrue;
638 #endif /* PROFILING */
641 /* -----------------------------------------------------------------------------
642 * Aggregate the heap census info for biographical profiling
643 * -------------------------------------------------------------------------- */
646 aggregateCensusInfo( void )
650 counter *c, *d, *ctrs;
653 if (!doingLDVProfiling()) return;
655 // Aggregate the LDV counters when displaying by biography.
656 if (RtsFlags.ProfFlags.doHeapProfile == HEAP_BY_LDV) {
657 int void_total, drag_total;
659 // Now we compute void_total and drag_total for each census
662 for (t = 1; t < era; t++) { // note: start at 1, not 0
663 void_total += censuses[t].void_total;
664 drag_total += censuses[t].drag_total;
665 censuses[t].void_total = void_total;
666 censuses[t].drag_total = drag_total;
667 ASSERT( censuses[t].void_total <= censuses[t].not_used );
668 ASSERT( censuses[t].drag_total <= censuses[t].used );
674 // otherwise... we're doing a heap profile that is restricted to
675 // some combination of lag, drag, void or use. We've kept all the
676 // census info for all censuses so far, but we still need to
677 // aggregate the counters forwards.
680 acc = allocHashTable();
683 for (t = 1; t < era; t++) {
685 // first look through all the counters we're aggregating
686 for (c = ctrs; c != NULL; c = c->next) {
687 // if one of the totals is non-zero, then this closure
688 // type must be present in the heap at this census time...
689 d = lookupHashTable(censuses[t].hash, (StgWord)c->identity);
692 // if this closure identity isn't present in the
693 // census for this time period, then our running
694 // totals *must* be zero.
695 ASSERT(c->c.ldv.void_total == 0 && c->c.ldv.drag_total == 0);
697 // debugCCS(c->identity);
698 // debugBelch(" census=%d void_total=%d drag_total=%d\n",
699 // t, c->c.ldv.void_total, c->c.ldv.drag_total);
701 d->c.ldv.void_total += c->c.ldv.void_total;
702 d->c.ldv.drag_total += c->c.ldv.drag_total;
703 c->c.ldv.void_total = d->c.ldv.void_total;
704 c->c.ldv.drag_total = d->c.ldv.drag_total;
706 ASSERT( c->c.ldv.void_total >= 0 );
707 ASSERT( c->c.ldv.drag_total >= 0 );
711 // now look through the counters in this census to find new ones
712 for (c = censuses[t].ctrs; c != NULL; c = c->next) {
713 d = lookupHashTable(acc, (StgWord)c->identity);
715 d = arenaAlloc( arena, sizeof(counter) );
717 insertHashTable( acc, (StgWord)c->identity, d );
718 d->identity = c->identity;
721 d->c.ldv.void_total = c->c.ldv.void_total;
722 d->c.ldv.drag_total = c->c.ldv.drag_total;
724 ASSERT( c->c.ldv.void_total >= 0 );
725 ASSERT( c->c.ldv.drag_total >= 0 );
729 freeHashTable(acc, NULL);
734 /* -----------------------------------------------------------------------------
735 * Print out the results of a heap census.
736 * -------------------------------------------------------------------------- */
738 dumpCensus( Census *census )
743 printSample(rtsTrue, census->time);
746 if (RtsFlags.ProfFlags.doHeapProfile == HEAP_BY_LDV) {
747 fprintf(hp_file, "VOID\t%lu\n", census->void_total * sizeof(W_));
748 fprintf(hp_file, "LAG\t%lu\n",
749 (census->not_used - census->void_total) * sizeof(W_));
750 fprintf(hp_file, "USE\t%lu\n",
751 (census->used - census->drag_total) * sizeof(W_));
752 fprintf(hp_file, "INHERENT_USE\t%lu\n",
753 census->prim * sizeof(W_));
754 fprintf(hp_file, "DRAG\t%lu\n", census->drag_total *
756 printSample(rtsFalse, census->time);
761 for (ctr = census->ctrs; ctr != NULL; ctr = ctr->next) {
764 if (RtsFlags.ProfFlags.bioSelector != NULL) {
766 if (strMatchesSelector("lag", RtsFlags.ProfFlags.bioSelector))
767 count += ctr->c.ldv.not_used - ctr->c.ldv.void_total;
768 if (strMatchesSelector("drag", RtsFlags.ProfFlags.bioSelector))
769 count += ctr->c.ldv.drag_total;
770 if (strMatchesSelector("void", RtsFlags.ProfFlags.bioSelector))
771 count += ctr->c.ldv.void_total;
772 if (strMatchesSelector("use", RtsFlags.ProfFlags.bioSelector))
773 count += ctr->c.ldv.used - ctr->c.ldv.drag_total;
777 count = ctr->c.resid;
780 ASSERT( count >= 0 );
782 if (count == 0) continue;
784 #ifdef DEBUG_HEAP_PROF
785 switch (RtsFlags.ProfFlags.doHeapProfile) {
786 case HEAP_BY_INFOPTR:
787 fprintf(hp_file, "%s", lookupGHCName(ctr->identity));
789 case HEAP_BY_CLOSURE_TYPE:
790 fprintf(hp_file, "%s", (char *)ctr->identity);
796 switch (RtsFlags.ProfFlags.doHeapProfile) {
798 fprint_ccs(hp_file, (CostCentreStack *)ctr->identity, 25);
803 fprintf(hp_file, "%s", (char *)ctr->identity);
805 case HEAP_BY_RETAINER:
807 RetainerSet *rs = (RetainerSet *)ctr->identity;
809 // it might be the distinguished retainer set rs_MANY:
810 if (rs == &rs_MANY) {
811 fprintf(hp_file, "MANY");
815 // Mark this retainer set by negating its id, because it
816 // has appeared in at least one census. We print the
817 // values of all such retainer sets into the log file at
818 // the end. A retainer set may exist but not feature in
819 // any censuses if it arose as the intermediate retainer
820 // set for some closure during retainer set calculation.
824 // report in the unit of bytes: * sizeof(StgWord)
825 printRetainerSetShort(hp_file, rs);
829 barf("dumpCensus; doHeapProfile");
833 fprintf(hp_file, "\t%ld\n", count * sizeof(W_));
836 printSample(rtsFalse, census->time);
839 /* -----------------------------------------------------------------------------
840 * Code to perform a heap census.
841 * -------------------------------------------------------------------------- */
843 heapCensusChain( Census *census, bdescr *bd )
853 for (; bd != NULL; bd = bd->link) {
855 // HACK: ignore pinned blocks, because they contain gaps.
856 // It's not clear exactly what we'd like to do here, since we
857 // can't tell which objects in the block are actually alive.
858 // Perhaps the whole block should be counted as SYSTEM memory.
859 if (bd->flags & BF_PINNED) {
864 while (p < bd->free) {
865 info = get_itbl((StgClosure *)p);
868 switch (info->type) {
875 case IND_OLDGEN_PERM:
877 case SE_CAF_BLACKHOLE:
881 case CONSTR_CHARLIKE:
895 size = sizeW_fromITBL(info);
900 size = bco_sizeW((StgBCO *)p);
909 size = sizeW_fromITBL(info);
912 case THUNK_1_0: /* ToDo - shouldn't be here */
913 case THUNK_0_1: /* " ditto " */
915 size = sizeofW(StgHeader) + MIN_UPD_SIZE;
920 size = pap_sizeW((StgPAP *)p);
924 size = ap_stack_sizeW((StgAP_STACK *)p);
929 size = arr_words_sizeW(stgCast(StgArrWords*,p));
933 case MUT_ARR_PTRS_FROZEN:
935 size = mut_arr_ptrs_sizeW((StgMutArrPtrs *)p);
940 #ifdef DEBUG_HEAP_PROF
941 size = tso_sizeW((StgTSO *)p);
944 if (RtsFlags.ProfFlags.includeTSOs) {
945 size = tso_sizeW((StgTSO *)p);
948 // Skip this TSO and move on to the next object
949 p += tso_sizeW((StgTSO *)p);
960 #ifdef DEBUG_HEAP_PROF
963 // subtract the profiling overhead
964 real_size = size - sizeofW(StgProfHeader);
967 if (closureSatisfiesConstraints((StgClosure*)p)) {
969 if (RtsFlags.ProfFlags.doHeapProfile == HEAP_BY_LDV) {
971 census->prim += real_size;
972 else if ((LDVW(p) & LDV_STATE_MASK) == LDV_STATE_CREATE)
973 census->not_used += real_size;
975 census->used += real_size;
979 identity = closureIdentity((StgClosure *)p);
981 if (identity != NULL) {
982 ctr = lookupHashTable( census->hash, (StgWord)identity );
985 if (RtsFlags.ProfFlags.bioSelector != NULL) {
987 ctr->c.ldv.prim += real_size;
988 else if ((LDVW(p) & LDV_STATE_MASK) == LDV_STATE_CREATE)
989 ctr->c.ldv.not_used += real_size;
991 ctr->c.ldv.used += real_size;
995 ctr->c.resid += real_size;
998 ctr = arenaAlloc( census->arena, sizeof(counter) );
1000 insertHashTable( census->hash, (StgWord)identity, ctr );
1001 ctr->identity = identity;
1002 ctr->next = census->ctrs;
1006 if (RtsFlags.ProfFlags.bioSelector != NULL) {
1008 ctr->c.ldv.prim = real_size;
1009 else if ((LDVW(p) & LDV_STATE_MASK) == LDV_STATE_CREATE)
1010 ctr->c.ldv.not_used = real_size;
1012 ctr->c.ldv.used = real_size;
1016 ctr->c.resid = real_size;
1034 census = &censuses[era];
1035 census->time = mut_user_time();
1037 // calculate retainer sets if necessary
1039 if (doingRetainerProfiling()) {
1045 stat_startHeapCensus();
1048 // Traverse the heap, collecting the census info
1050 // First the small_alloc_list: we have to fix the free pointer at
1051 // the end by calling tidyAllocatedLists() first.
1052 tidyAllocateLists();
1053 heapCensusChain( census, small_alloc_list );
1055 // Now traverse the heap in each generation/step.
1056 if (RtsFlags.GcFlags.generations == 1) {
1057 heapCensusChain( census, g0s0->to_blocks );
1059 for (g = 0; g < RtsFlags.GcFlags.generations; g++) {
1060 for (s = 0; s < generations[g].n_steps; s++) {
1061 heapCensusChain( census, generations[g].steps[s].blocks );
1062 // Are we interested in large objects? might be
1063 // confusing to include the stack in a heap profile.
1064 heapCensusChain( census, generations[g].steps[s].large_objects );
1069 // dump out the census info
1071 // We can't generate any info for LDV profiling until
1072 // the end of the run...
1073 if (!doingLDVProfiling())
1074 dumpCensus( census );
1076 dumpCensus( census );
1080 // free our storage, unless we're keeping all the census info for
1081 // future restriction by biography.
1083 if (RtsFlags.ProfFlags.bioSelector == NULL)
1086 freeHashTable( census->hash, NULL/* don't free the elements */ );
1087 arenaFree( census->arena );
1088 census->hash = NULL;
1089 census->arena = NULL;
1092 // we're into the next time period now
1096 stat_endHeapCensus();
1100 #endif /* PROFILING || DEBUG_HEAP_PROF */