[Git][ghc/ghc][wip/tsan-ghc-8.10] rts/Stats: Reintroduce mut_user_time
Ben Gamari
gitlab at gitlab.haskell.org
Wed Nov 25 00:43:22 UTC 2020
Ben Gamari pushed to branch wip/tsan-ghc-8.10 at Glasgow Haskell Compiler / GHC
Commits:
b781156f by Ben Gamari at 2020-11-24T19:42:27-05:00
rts/Stats: Reintroduce mut_user_time
Fix the previous backport; this function was dead code in master but is
still needed due to ProfHeap.c in ghc-8.10.
- - - - -
2 changed files:
- rts/Stats.c
- rts/Stats.h
Changes:
=====================================
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.
=====================================
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);
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/b781156f4802dd2770fff3080200d497a76d8baf
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/b781156f4802dd2770fff3080200d497a76d8baf
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20201124/73cf2098/attachment-0001.html>
More information about the ghc-commits
mailing list