[project @ 2001-10-22 16:02:44 by sewardj]
[ghc-hetmet.git] / ghc / rts / Proftimer.c
index bd50c98..42766d3 100644 (file)
@@ -1,62 +1,43 @@
 /* -----------------------------------------------------------------------------
- * $Id: Proftimer.c,v 1.2 1998/12/02 13:28:36 simonm Exp $
+ * $Id: Proftimer.c,v 1.7 2001/08/14 13:40:09 sewardj Exp $
  *
- * (c) The GHC Team, 1998
+ * (c) The GHC Team, 1998-1999
  *
  * Profiling interval timer
  *
  * ---------------------------------------------------------------------------*/
 
-/* Only have cost centres etc if PROFILING defined */
-
 #if defined (PROFILING)
 
+#include "PosixSource.h"
 #include "Rts.h"
-#include "ProfRts.h"
+#include "Profiling.h"
 #include "Itimer.h"
 #include "Proftimer.h"
 
-lnat total_ticks = 0;
-
-nat current_interval = 1;               /* Current interval number -- 
-                                          stored in AGE */
-
-nat interval_ticks = DEFAULT_INTERVAL;  /* No of ticks in an interval */
-
-nat previous_ticks = 0;                 /* ticks in previous intervals */
-nat current_ticks = 0;                  /* ticks in current interval */
-
-void
-initProfTimer(nat ms)
-{
-  if (initialize_virtual_timer(ms)) {
-    fflush(stdout);
-    fprintf(stderr, "Can't initialize virtual timer.\n");
-    stg_exit(EXIT_FAILURE);
-  }
-};
+rtsBool do_prof_ticks = rtsFalse;       /* enable profiling ticks */
 
 void
 stopProfTimer(void)
 {                              /* Stops time profile */
-  if (time_profiling) {
-    initProfTimer(0);
-  }
+    if (time_profiling) {
+       do_prof_ticks = rtsFalse;
+    }
 };
 
 void
 startProfTimer(void)
 {                              /* Starts time profile */
-  if (time_profiling) {
-    initProfTimer(TICK_MILLISECS);
-  }
+    if (time_profiling) {
+       do_prof_ticks = rtsTrue;
+    }
 };
 
 void
 handleProfTick(void)
 {
-  CCS_TICK(CCCS);
-  total_ticks++;
-};
-
+    if (do_prof_ticks) {
+       CCS_TICK(CCCS);
+    }
+}
 #endif /* PROFILING */