summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2020-11-24 19:42:27 -0500
committerBen Gamari <ben@well-typed.com>2020-12-01 12:48:55 -0500
commit0f28389c783a54a74c472f176c250ddf7a9c4bf4 (patch)
treef24b08e2336dd043e9030a07a6124bd4eee83c6a
parent9ad6e1f12e99330adeacc3b6eea52c6f26324a46 (diff)
downloadhaskell-0f28389c783a54a74c472f176c250ddf7a9c4bf4.tar.gz
rts/Stats: Reintroduce mut_user_timewip/tsan-ghc-8.10
Fix the previous backport; this function was dead code in master but is still needed due to ProfHeap.c in ghc-8.10.
-rw-r--r--rts/Stats.c21
-rw-r--r--rts/Stats.h2
2 files changed, 23 insertions, 0 deletions
diff --git a/rts/Stats.c b/rts/Stats.c
index 1a91e706fb..282e799d23 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 9d62acef37..cd8b74a983 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);