X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=rts%2FStats.c;h=e519c940af8d4aa171afa4ae24ed7d5dcce9e64f;hb=d8334d807812e40f67770ffc37608c0ce66f96b2;hp=ed21ec5e881850464a9d189eaf870dba11878a20;hpb=3fb074b5fcfd91fe0d37af83f221450ac4734908;p=ghc-hetmet.git diff --git a/rts/Stats.c b/rts/Stats.c index ed21ec5..e519c94 100644 --- a/rts/Stats.c +++ b/rts/Stats.c @@ -258,7 +258,8 @@ stat_startExit(void) PROF_VAL(RPe_tot_time + HCe_tot_time) - InitElapsedStamp; if (MutElapsedTime < 0) { MutElapsedTime = 0; } /* sometimes -0.00 */ - MutUserTime = user - GC_tot_time - PROF_VAL(RP_tot_time + HC_tot_time) - InitUserTime; + MutUserTime = user - GC_tot_time - + PROF_VAL(RP_tot_time + HC_tot_time) - InitUserTime; if (MutUserTime < 0) { MutUserTime = 0; } #if USE_PAPI @@ -314,15 +315,11 @@ stat_startGC(void) } } -#if defined(PROFILING) || defined(DEBUG) - GC_start_time = getProcessCPUTime(); // needed in mut_user_time_during_GC() -#endif - - if (RtsFlags.GcFlags.giveStats != NO_GC_STATS) { -#if !defined(PROFILING) && !defined(DEBUG) - GC_start_time = getProcessCPUTime(); -#endif - GCe_start_time = getProcessElapsedTime(); + if (RtsFlags.GcFlags.giveStats != NO_GC_STATS + || RtsFlags.ProfFlags.doHeapProfile) + // heap profiling needs GC_tot_time + { + getProcessTimes(&GC_start_time, &GCe_start_time); if (RtsFlags.GcFlags.giveStats) { GC_start_faults = getPageFaults(); } @@ -346,7 +343,10 @@ void stat_endGC (lnat alloc, lnat live, lnat copied, lnat gen, lnat max_copied, lnat avg_copied, lnat slop) { - if (RtsFlags.GcFlags.giveStats != NO_GC_STATS) { + if (RtsFlags.GcFlags.giveStats != NO_GC_STATS || + RtsFlags.ProfFlags.doHeapProfile) + // heap profiling needs GC_tot_time + { Ticks time, etime, gc_time, gc_etime; getProcessTimes(&time, &etime); @@ -589,8 +589,8 @@ stat_exit(int alloc) statsPrintf("%16s bytes maximum slop\n", temp); statsPrintf("%16ld MB total memory in use (%ld MB lost due to fragmentation)\n\n", - mblocks_allocated * MBLOCK_SIZE_W / (1024 * 1024 / sizeof(W_)), - (mblocks_allocated * MBLOCK_SIZE_W - hw_alloc_blocks * BLOCK_SIZE_W) / (1024 * 1024 / sizeof(W_))); + peak_mblocks_allocated * MBLOCK_SIZE_W / (1024 * 1024 / sizeof(W_)), + (peak_mblocks_allocated * BLOCKS_PER_MBLOCK * BLOCK_SIZE_W - hw_alloc_blocks * BLOCK_SIZE_W) / (1024 * 1024 / sizeof(W_))); /* Print garbage collections in each gen */ for (g = 0; g < RtsFlags.GcFlags.generations; g++) {