rts: Fix inconsistencies in how retainer and heap censuses are timed.
authorDouglas Wilson <douglas.wilson@gmail.com>
Tue, 21 Nov 2017 23:05:22 +0000 (18:05 -0500)
committerBen Gamari <ben@smart-cactus.org>
Wed, 22 Nov 2017 02:11:05 +0000 (21:11 -0500)
mut_elapsed should deduct retainer profiling and heap censuses, just as
mut_cpu does.

mutator_cpu_ns should not deduct retainer profiling or heap censuses,
since those times are included in stats.gc_cpu_ns.

Reviewers: bgamari, erikd, simonmar

Reviewed By: simonmar

Subscribers: rwbarton, thomie

Differential Revision: https://phabricator.haskell.org/D4185

rts/Stats.c

index 8f7865b..fa85878 100644 (file)
@@ -633,7 +633,8 @@ stat_exit (void)
         exit_elapsed = end_exit_elapsed - start_exit_elapsed - exit_gc_elapsed;
 
         mut_elapsed = start_exit_elapsed - end_init_elapsed -
-            (gc_elapsed - exit_gc_elapsed);
+            (gc_elapsed - exit_gc_elapsed) -
+            PROF_VAL(RPe_tot_time + HCe_tot_time);
 
         mut_cpu = start_exit_cpu - end_init_cpu - (gc_cpu - exit_gc_cpu)
             - PROF_VAL(RP_tot_time + HC_tot_time);
@@ -1010,8 +1011,7 @@ void getRTSStats( RTSStats *s )
     s->cpu_ns = current_cpu - end_init_cpu;
     s->elapsed_ns = current_elapsed - end_init_elapsed;
 
-    s->mutator_cpu_ns = current_cpu - end_init_cpu - stats.gc_cpu_ns -
-        PROF_VAL(RP_tot_time + HC_tot_time);
+    s->mutator_cpu_ns = current_cpu - end_init_cpu - stats.gc_cpu_ns;
     s->mutator_elapsed_ns = current_elapsed - end_init_elapsed -
         stats.gc_elapsed_ns;
 }