diff --git a/rts/Stats.c b/rts/Stats.c index 1a91e706fb8442c8a050dbe232a559b45c8f3475..282e799d23a7038f847b4cc5822f0e82f6774d09 100644 --- a/rts/Stats.c +++ b/rts/Stats.c @@ -86,6 +86,27 @@ Time stat_getElapsedTime(void) Measure the current MUT time, for profiling ------------------------------------------------------------------------ */ +static double +mut_user_time_until( Time t ) +{ + ACQUIRE_LOCK(&stats_mutex); + double ret = TimeToSecondsDbl(t - stats.gc_cpu_ns - stats.nonmoving_gc_cpu_ns); + RELEASE_LOCK(&stats_mutex); + return ret; + // heapCensus() time is included in GC_tot_cpu, so we don't need + // to subtract it here. + + // TODO: This seems wrong to me. Surely we should be subtracting + // (at least) start_init_cpu? +} + +double +mut_user_time( void ) +{ + Time cpu = getProcessCPUTime(); + return mut_user_time_until(cpu); +} + #if defined(PROFILING) /* mut_user_time_during_RP() returns the MUT time during retainer profiling. diff --git a/rts/Stats.h b/rts/Stats.h index 9d62acef371de6a7e85f4c9a3a1ff19e0ed7626c..cd8b74a983be14f8d82241f62b867ef194a69f21 100644 --- a/rts/Stats.h +++ b/rts/Stats.h @@ -66,6 +66,8 @@ void initStats0(void); void initStats1(void); void resetChildProcessStats(void); +double mut_user_time(void); + void statDescribeGens( void ); Time stat_getElapsedGCTime(void);