[commit: ghc] master: Avoid unnecessary clock_gettime() syscalls in GC stats. (3c9fc10)

git at git.haskell.org git at git.haskell.org
Thu Jul 10 16:21:40 UTC 2014


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/3c9fc104337a142fe4f375d30d7a6b81d55a70c1/ghc

>---------------------------------------------------------------

commit 3c9fc104337a142fe4f375d30d7a6b81d55a70c1
Author: Brian Brooks <brooks.brian at gmail.com>
Date:   Thu Jul 10 02:55:33 2014 -0500

    Avoid unnecessary clock_gettime() syscalls in GC stats.
    
    Summary: Avoid unnecessary clock_gettime() syscalls in GC stats.
    
    Test Plan: Use strace.
    
    Reviewers: simonmar, austin
    
    Reviewed By: simonmar, austin
    
    Subscribers: simonmar, relrod, carter
    
    Differential Revision: https://phabricator.haskell.org/D39


>---------------------------------------------------------------

3c9fc104337a142fe4f375d30d7a6b81d55a70c1
 rts/Stats.c       | 45 ++-------------------------------------------
 rts/Stats.h       |  3 ---
 rts/sm/GC.c       |  5 -----
 rts/sm/GCThread.h |  3 +--
 4 files changed, 3 insertions(+), 53 deletions(-)

diff --git a/rts/Stats.c b/rts/Stats.c
index 48c320c..c3d963c 100644
--- a/rts/Stats.c
+++ b/rts/Stats.c
@@ -173,8 +173,8 @@ initStats1 (void)
     nat i;
   
     if (RtsFlags.GcFlags.giveStats >= VERBOSE_GC_STATS) {
-	statsPrintf("    Alloc    Copied     Live    GC    GC     TOT     TOT  Page Flts\n");
-	statsPrintf("    bytes     bytes     bytes  user  elap    user    elap\n");
+        statsPrintf("    Alloc    Copied     Live    GC    GC     TOT     TOT  Page Flts\n");
+        statsPrintf("    bytes     bytes     bytes  user  elap    user    elap\n");
     }
     GC_coll_cpu = 
 	(Time *)stgMallocBytes(
@@ -287,53 +287,12 @@ stat_startGC (Capability *cap, gc_thread *gct)
     traceEventGcStartAtT(cap,
                          TimeToNS(gct->gc_start_elapsed - start_init_elapsed));
 
-    gct->gc_start_thread_cpu = getThreadCPUTime();
-
     if (RtsFlags.GcFlags.giveStats != NO_GC_STATS)
     {
         gct->gc_start_faults = getPageFaults();
     }
 }
 
-void
-stat_gcWorkerThreadStart (gc_thread *gct STG_UNUSED)
-{
-#if 0
-    /*
-     * We dont' collect per-thread GC stats any more, but this code
-     * could be used to do that if we want to in the future:
-     */
-    if (RtsFlags.GcFlags.giveStats != NO_GC_STATS)
-    {
-        getProcessTimes(&gct->gc_start_cpu, &gct->gc_start_elapsed);
-        gct->gc_start_thread_cpu  = getThreadCPUTime();
-    }
-#endif
-}
-
-void
-stat_gcWorkerThreadDone (gc_thread *gct STG_UNUSED)
-{
-#if 0
-    /*
-     * We dont' collect per-thread GC stats any more, but this code
-     * could be used to do that if we want to in the future:
-     */
-    Time thread_cpu, elapsed, gc_cpu, gc_elapsed;
-
-    if (RtsFlags.GcFlags.giveStats != NO_GC_STATS)
-    {
-        elapsed    = getProcessElapsedTime();
-        thread_cpu = getThreadCPUTime();
-
-        gc_cpu     = thread_cpu - gct->gc_start_thread_cpu;
-        gc_elapsed = elapsed    - gct->gc_start_elapsed;
-    
-        taskDoneGC(gct->cap->running_task, gc_cpu, gc_elapsed);
-    }
-#endif
-}
-
 /* -----------------------------------------------------------------------------
  * Calculate the total allocated memory since the start of the
  * program.  Also emits events reporting the per-cap allocation
diff --git a/rts/Stats.h b/rts/Stats.h
index 9839e5c..925920f 100644
--- a/rts/Stats.h
+++ b/rts/Stats.h
@@ -32,9 +32,6 @@ void      stat_endGC  (Capability *cap, struct gc_thread_ *_gct,
                        W_ live, W_ copied, W_ slop, nat gen,
                        nat n_gc_threads, W_ par_max_copied, W_ par_tot_copied);
 
-void stat_gcWorkerThreadStart (struct gc_thread_ *_gct);
-void stat_gcWorkerThreadDone  (struct gc_thread_ *_gct);
-
 #ifdef PROFILING
 void      stat_startRP(void);
 void      stat_endRP(nat, 
diff --git a/rts/sm/GC.c b/rts/sm/GC.c
index 61432ea..dabcd72 100644
--- a/rts/sm/GC.c
+++ b/rts/sm/GC.c
@@ -1041,8 +1041,6 @@ gcWorkerThread (Capability *cap)
     SET_GCT(gc_threads[cap->no]);
     gct->id = osThreadId();
 
-    stat_gcWorkerThreadStart(gct);
-
     // Wait until we're told to wake up
     RELEASE_SPIN_LOCK(&gct->mut_spin);
     // yieldThread();
@@ -1100,9 +1098,6 @@ gcWorkerThread (Capability *cap)
     ACQUIRE_SPIN_LOCK(&gct->mut_spin);
     debugTrace(DEBUG_gc, "GC thread %d on my way...", gct->thread_index);
 
-    // record the time spent doing GC in the Task structure
-    stat_gcWorkerThreadDone(gct);
-
     SET_GCT(saved_gct);
 }
 
diff --git a/rts/sm/GCThread.h b/rts/sm/GCThread.h
index 12ef999..84ce3f0 100644
--- a/rts/sm/GCThread.h
+++ b/rts/sm/GCThread.h
@@ -77,7 +77,7 @@
    ------------------------------------------------------------------------- */
 
 typedef struct gen_workspace_ {
-    generation * gen;		// the gen for this workspace 
+    generation * gen;           // the gen for this workspace
     struct gc_thread_ * my_gct; // the gc_thread that contains this workspace
 
     // where objects to be scavenged go
@@ -184,7 +184,6 @@ typedef struct gc_thread_ {
 
     Time gc_start_cpu;   // process CPU time
     Time gc_start_elapsed;  // process elapsed time
-    Time gc_start_thread_cpu; // thread CPU time
     W_ gc_start_faults;
 
     // -------------------



More information about the ghc-commits mailing list