summaryrefslogtreecommitdiff
path: root/rts/Stats.c
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2011-10-26 15:15:50 +0100
committerSimon Marlow <marlowsd@gmail.com>2011-11-02 16:34:04 +0000
commitbd72eeb184a95ae0ae79ccad19c8ccc2b45a12e0 (patch)
tree649f18e9c5299a6bc750a9167f8c5893967d530f /rts/Stats.c
parent0047d2c3c47e2d88024fec5ee71c0de5053c1593 (diff)
downloadhaskell-bd72eeb184a95ae0ae79ccad19c8ccc2b45a12e0.tar.gz
fix time calculation for retainer profiling
Diffstat (limited to 'rts/Stats.c')
-rw-r--r--rts/Stats.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/rts/Stats.c b/rts/Stats.c
index b3b0f804d6..23cb4bffaa 100644
--- a/rts/Stats.c
+++ b/rts/Stats.c
@@ -89,7 +89,9 @@ Ticks stat_getElapsedTime(void)
double
mut_user_time_until( Ticks t )
{
- return TICK_TO_DBL(t - GC_tot_cpu - PROF_VAL(RP_tot_time));
+ return TICK_TO_DBL(t - GC_tot_cpu);
+ // heapCensus() time is included in GC_tot_cpu, so we don't need
+ // to subtract it here.
}
double
@@ -108,13 +110,13 @@ mut_user_time( void )
double
mut_user_time_during_RP( void )
{
- return TICK_TO_DBL(RP_start_time - GC_tot_cpu - RP_tot_time);
+ return TICK_TO_DBL(RP_start_time - GC_tot_cpu - RP_tot_time);
}
double
mut_user_time_during_heap_census( void )
{
- return TICK_TO_DBL(HC_start_time - GC_tot_cpu - RP_tot_time);
+ return TICK_TO_DBL(HC_start_time - GC_tot_cpu - RP_tot_time);
}
#endif /* PROFILING */
@@ -560,6 +562,12 @@ stat_exit(int alloc)
gc_elapsed += GC_coll_elapsed[i];
}
+ // heapCensus() is called by the GC, so RP and HC time are
+ // included in the GC stats. We therefore subtract them to
+ // obtain the actual GC cpu time. XXX: we aren't doing this
+ // for elapsed time.
+ gc_cpu -= 0 + PROF_VAL(RP_tot_time + HC_tot_time);
+
init_cpu = get_init_cpu();
init_elapsed = get_init_elapsed();