X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=rts%2FProfHeap.c;h=e93151d4f44dd930b9fd4067c33157268b3535eb;hb=8b08c15b8ace5a76e341939081fbb6ad2736ddd1;hp=312bee735c16c885f60a588bfa846efa647086a8;hpb=0065d5ab628975892cea1ec7303f968c3338cbe1;p=ghc-hetmet.git diff --git a/rts/ProfHeap.c b/rts/ProfHeap.c index 312bee7..e93151d 100644 --- a/rts/ProfHeap.c +++ b/rts/ProfHeap.c @@ -19,7 +19,6 @@ #include "RtsUtils.h" #include "RtsFlags.h" #include "Profiling.h" -#include "Storage.h" #include "ProfHeap.h" #include "Stats.h" #include "Hash.h" @@ -114,8 +113,6 @@ static void dumpCensus( Census *census ); static char *type_names[] = { "INVALID_OBJECT" , "CONSTR" - , "CONSTR_INTLIKE" - , "CONSTR_CHARLIKE" , "CONSTR_STATIC" , "CONSTR_NOCAF_STATIC" @@ -319,6 +316,13 @@ initEra(Census *census) census->drag_total = 0; } +STATIC_INLINE void +freeEra(Census *census) +{ + arenaFree(census->arena); + freeHashTable(census->hash, NULL); +} + /* -------------------------------------------------------------------------- * Increases era by 1 and initialize census[era]. * Reallocates gi[] and increases its size if needed. @@ -358,6 +362,10 @@ void initProfiling1( void ) { } +void freeProfiling1( void ) +{ +} + void initProfiling2( void ) { if (RtsFlags.ProfFlags.doHeapProfile) { @@ -388,9 +396,9 @@ printSample(rtsBool beginSample, StgDouble sampleValue) { StgDouble fractionalPart, integralPart; fractionalPart = modf(sampleValue, &integralPart); - fprintf(hp_file, "%s %d.%02d\n", + fprintf(hp_file, "%s %" FMT_Word64 ".%02" FMT_Word64 "\n", (beginSample ? "BEGIN_SAMPLE" : "END_SAMPLE"), - (int)integralPart, (int)(fractionalPart * 100)); + (StgWord64)integralPart, (StgWord64)(fractionalPart * 100)); } /* -------------------------------------------------------------------------- @@ -496,6 +504,14 @@ endHeapProfiling(void) } #endif + { + nat t; + for (t = 0; t <= era; t++) { + freeEra( &censuses[t] ); + } + } + stgFree(censuses); + seconds = mut_user_time(); printSample(rtsTrue, seconds); printSample(rtsFalse, seconds); @@ -543,10 +559,10 @@ fprint_ccs(FILE *fp, CostCentreStack *ccs, nat max_length) p += buf_append(p, ccs->cc->module, buf_end); p += buf_append(p, ".CAF", buf_end); } else { + p += buf_append(p, ccs->cc->label, buf_end); if (ccs->prevStack != NULL && ccs->prevStack != CCS_MAIN) { p += buf_append(p, "/", buf_end); } - p += buf_append(p, ccs->cc->label, buf_end); } if (p >= buf_end) { @@ -808,7 +824,7 @@ dumpCensus( Census *census ) #ifdef PROFILING switch (RtsFlags.ProfFlags.doHeapProfile) { case HEAP_BY_CCS: - fprint_ccs(hp_file, (CostCentreStack *)ctr->identity, 25); + fprint_ccs(hp_file, (CostCentreStack *)ctr->identity, RtsFlags.ProfFlags.ccsLength); break; case HEAP_BY_MOD: case HEAP_BY_DESCR: @@ -905,8 +921,6 @@ heapCensusChain( Census *census, bdescr *bd ) case SE_CAF_BLACKHOLE: case SE_BLACKHOLE: case BLACKHOLE: - case CONSTR_INTLIKE: - case CONSTR_CHARLIKE: case FUN_1_0: case FUN_0_1: case FUN_1_1: @@ -991,9 +1005,19 @@ heapCensusChain( Census *census, bdescr *bd ) size = sizeofW(StgTRecHeader); break; - case TVAR_WAIT_QUEUE: + case TVAR_WATCH_QUEUE: + prim = rtsTrue; + size = sizeofW(StgTVarWatchQueue); + break; + + case INVARIANT_CHECK_QUEUE: + prim = rtsTrue; + size = sizeofW(StgInvariantCheckQueue); + break; + + case ATOMIC_INVARIANT: prim = rtsTrue; - size = sizeofW(StgTVarWaitQueue); + size = sizeofW(StgAtomicInvariant); break; case TVAR: