X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Frts%2FProfHeap.c;h=59447e494efa6d5abae52af3274f0191176458f1;hb=8a223184539a3d6959690580b38b23b489a67408;hp=70cafdede168da1165562a61cb303dbcb31daab8;hpb=0f3205e6c40575910d50bc2cc42020ccf55e07ba;p=ghc-hetmet.git diff --git a/ghc/rts/ProfHeap.c b/ghc/rts/ProfHeap.c index 70cafde..59447e4 100644 --- a/ghc/rts/ProfHeap.c +++ b/ghc/rts/ProfHeap.c @@ -23,7 +23,6 @@ #include "ProfHeap.h" #include "Stats.h" #include "Hash.h" -#include "StrHash.h" #include "RetainerProfile.h" #include "LdvProfile.h" #include "Arena.h" @@ -159,7 +158,6 @@ static char *type_names[] = { , "MUT_VAR" , "WEAK" - , "FOREIGN" , "TSO" @@ -405,7 +403,7 @@ initHeapProfiling(void) #ifdef PROFILING if (doingLDVProfiling() && doingRetainerProfiling()) { errorBelch("cannot mix -hb and -hr"); - stg_exit(1); + stg_exit(EXIT_FAILURE); } #endif @@ -744,15 +742,15 @@ dumpCensus( Census *census ) #ifdef PROFILING if (RtsFlags.ProfFlags.doHeapProfile == HEAP_BY_LDV) { - fprintf(hp_file, "VOID\t%lu\n", census->void_total * sizeof(W_)); + fprintf(hp_file, "VOID\t%lu\n", (unsigned long)(census->void_total) * sizeof(W_)); fprintf(hp_file, "LAG\t%lu\n", - (census->not_used - census->void_total) * sizeof(W_)); + (unsigned long)(census->not_used - census->void_total) * sizeof(W_)); fprintf(hp_file, "USE\t%lu\n", - (census->used - census->drag_total) * sizeof(W_)); + (unsigned long)(census->used - census->drag_total) * sizeof(W_)); fprintf(hp_file, "INHERENT_USE\t%lu\n", - census->prim * sizeof(W_)); - fprintf(hp_file, "DRAG\t%lu\n", census->drag_total * - sizeof(W_)); + (unsigned long)(census->prim) * sizeof(W_)); + fprintf(hp_file, "DRAG\t%lu\n", + (unsigned long)(census->drag_total) * sizeof(W_)); printSample(rtsFalse, census->time); return; } @@ -830,7 +828,7 @@ dumpCensus( Census *census ) } #endif - fprintf(hp_file, "\t%ld\n", count * sizeof(W_)); + fprintf(hp_file, "\t%lu\n", (unsigned long)count * sizeof(W_)); } printSample(rtsFalse, census->time); @@ -907,6 +905,17 @@ heapCensusChain( Census *census, bdescr *bd ) size = sizeW_fromITBL(info); break; + case IND: + // Special case/Delicate Hack: INDs don't normally + // appear, since we're doing this heap census right + // after GC. However, GarbageCollect() also does + // resurrectThreads(), which can update some + // blackholes when it calls raiseAsync() on the + // resurrected threads. So we know that any IND will + // be the size of a BLACKHOLE. + size = BLACKHOLE_sizeW(); + break; + case BCO: prim = rtsTrue; size = bco_sizeW((StgBCO *)p); @@ -914,7 +923,6 @@ heapCensusChain( Census *census, bdescr *bd ) case MVAR: case WEAK: - case FOREIGN: case STABLE_NAME: case MUT_VAR: prim = rtsTrue; @@ -940,6 +948,7 @@ heapCensusChain( Census *census, bdescr *bd ) case MUT_ARR_PTRS: case MUT_ARR_PTRS_FROZEN: + case MUT_ARR_PTRS_FROZEN0: prim = rtsTrue; size = mut_arr_ptrs_sizeW((StgMutArrPtrs *)p); break; @@ -960,8 +969,28 @@ heapCensusChain( Census *census, bdescr *bd ) } #endif + case TREC_HEADER: + prim = rtsTrue; + size = sizeofW(StgTRecHeader); + break; + + case TVAR_WAIT_QUEUE: + prim = rtsTrue; + size = sizeofW(StgTVarWaitQueue); + break; + + case TVAR: + prim = rtsTrue; + size = sizeofW(StgTVar); + break; + + case TREC_CHUNK: + prim = rtsTrue; + size = sizeofW(StgTRecChunk); + break; + default: - barf("heapCensus"); + barf("heapCensus, unknown object: %d", info->type); } identity = NULL; @@ -1063,7 +1092,7 @@ heapCensus( void ) // Now traverse the heap in each generation/step. if (RtsFlags.GcFlags.generations == 1) { - heapCensusChain( census, g0s0->to_blocks ); + heapCensusChain( census, g0s0->blocks ); } else { for (g = 0; g < RtsFlags.GcFlags.generations; g++) { for (s = 0; s < generations[g].n_steps; s++) {