[project @ 2002-01-24 07:50:01 by sof]
authorsof <unknown>
Thu, 24 Jan 2002 07:50:02 +0000 (07:50 +0000)
committersof <unknown>
Thu, 24 Jan 2002 07:50:02 +0000 (07:50 +0000)
SMP: misc tasks timing stats fixes

ghc/rts/Schedule.c
ghc/rts/Stats.c
ghc/rts/Stats.h

index 86a725f..7357762 100644 (file)
@@ -1,5 +1,5 @@
 /* ---------------------------------------------------------------------------
- * $Id: Schedule.c,v 1.112 2002/01/24 02:06:48 sof Exp $
+ * $Id: Schedule.c,v 1.113 2002/01/24 07:50:02 sof Exp $
  *
  * (c) The GHC Team, 1998-2000
  *
@@ -1907,7 +1907,7 @@ initScheduler(void)
   initCapability(&MainCapability);
 #endif
 
-#if defined(SMP) || defined(PAR)
+#if /* defined(SMP) ||*/ defined(PAR)
   initSparkPools();
 #endif
 }
@@ -1935,7 +1935,7 @@ startTasks( void )
     task_ids[i].mut_etime = 0.0;
     task_ids[i].gc_time = 0.0;
     task_ids[i].gc_etime = 0.0;
-    task_ids[i].elapsedtimestart = elapsedtime();
+    task_ids[i].elapsedtimestart = stat_getElapsedTime();
     IF_DEBUG(scheduler,fprintf(stderr,"scheduler: Started task: %ld\n",tid););
   }
 }
index 3eb5631..fab773c 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: Stats.c,v 1.41 2001/11/28 14:29:59 simonmar Exp $
+ * $Id: Stats.c,v 1.42 2002/01/24 07:50:01 sof Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
@@ -586,10 +586,12 @@ stat_workerStop(void)
     nat i;
     pthread_t me = pthread_self();
 
+    getTimes();
+
     for (i = 0; i < RtsFlags.ParFlags.nNodes; i++) {
        if (task_ids[i].id == me) {
-           task_ids[i].mut_time = usertime() - task_ids[i].gc_time;
-           task_ids[i].mut_etime = elapsedtime()
+           task_ids[i].mut_time = CurrentUserTime - task_ids[i].gc_time;
+           task_ids[i].mut_etime = CurrentElapsedTime
                - GCe_tot_time
                - task_ids[i].elapsedtimestart;
            if (task_ids[i].mut_time < 0.0)  { task_ids[i].mut_time = 0.0;  }
@@ -597,6 +599,12 @@ stat_workerStop(void)
        }
     }
 }
+
+long int stat_getElapsedTime ()
+{
+  getTimes();
+  return CurrentElapsedTime;
+}
 #endif
 
 /* -----------------------------------------------------------------------------
index 59fe58a..d6ab463 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: Stats.h,v 1.14 2001/11/26 16:54:22 simonmar Exp $
+ * $Id: Stats.h,v 1.15 2002/01/24 07:50:02 sof Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
@@ -46,3 +46,7 @@ extern double    mut_user_time_during_heap_census(void);
 
 extern void      statDescribeGens( void );
 extern HsInt     getAllocations( void );
+
+#ifdef SMP
+extern long int  stat_getElapsedTime ( void );
+#endif