Standardize clock parameter names to 'clock'.
[gem5.git] / sim / sim_events.cc
index 8a248148499bc2331f586923f8f63315edce4c2b..99c09f259b997bda32942f3ddbe7890a258373d9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003 The Regents of The University of Michigan
+ * Copyright (c) 2002-2004 The Regents of The University of Michigan
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
 
 #include <string>
 
-#include "cpu.hh"
-#include "eventq.hh"
-#include "hostinfo.hh"
-#include "sim_events.hh"
-#include "sim_exit.hh"
-#include "sim_stats.hh"
+#include "base/callback.hh"
+#include "base/hostinfo.hh"
+#include "sim/eventq.hh"
+#include "sim/param.hh"
+#include "sim/sim_events.hh"
+#include "sim/sim_exit.hh"
+#include "sim/startup.hh"
+#include "sim/stats.hh"
 
 using namespace std;
 
@@ -63,20 +65,19 @@ SimExitEvent::description()
     return "simulation termination";
 }
 
-
 //
 // constructor: automatically schedules at specified time
 //
 CountedExitEvent::CountedExitEvent(EventQueue *q, const std::string &_cause,
                                    Tick _when, int &_downCounter)
-    : Event(q),
+    : Event(q, Sim_Exit_Pri),
       cause(_cause),
       downCounter(_downCounter)
 {
     // catch stupid mistakes
     assert(downCounter > 0);
 
-    schedule(_when, 1000);
+    schedule(_when);
 }
 
 
@@ -87,7 +88,7 @@ void
 CountedExitEvent::process()
 {
     if (--downCounter == 0) {
-        new SimExitEvent(cause, 1);
+        new SimExitEvent(cause, 0);
     }
 }
 
@@ -98,20 +99,6 @@ CountedExitEvent::description()
     return "counted exit";
 }
 
-
-void
-DumpStatsEvent::process()
-{
-    dumpStats();
-}
-
-const char *
-DumpStatsEvent::description()
-{
-    return "stats dump";
-}
-
-
 #ifdef CHECK_SWAP_CYCLES
 new CheckSwapEvent(&mainEventQueue, CHECK_SWAP_CYCLES);
 #endif
@@ -143,33 +130,6 @@ CheckSwapEvent::description()
 }
 
 
-class DumpStatsContext : public ParamContext
-{
-  public:
-    DumpStatsContext(const string &_iniSection)
-        : ParamContext(_iniSection) {}
-    void checkParams();
-};
-
-DumpStatsContext dumpStatsParams("stats");
-
-VectorParam<Tick> dump_cycle(&dumpStatsParams, "dump_cycles",
-                               "cycles on which to dump stats");
-
-void
-DumpStatsContext::checkParams()
-{
-    if (dump_cycle.isValid()) {
-        vector<Tick> &cycles = dump_cycle;
-
-        vector<Tick>::iterator i = cycles.begin();
-        vector<Tick>::iterator end = cycles.end();
-
-        for (; i < end; ++i)
-            new DumpStatsEvent(*i);
-    }
-}
-
 ///////////////////////////////////////////////////
 //
 // Simulation termination parameters
@@ -220,7 +180,7 @@ class ProgressEvent : public Event
 ProgressEvent::ProgressEvent(EventQueue *q, Tick _interval)
     : Event(q), interval(_interval)
 {
-    schedule(interval);
+    schedule(curTick + interval);
 }
 
 //
@@ -250,12 +210,11 @@ ProgressEvent::description()
 
 // Parameter space for execution address tracing options.  Derive
 // from ParamContext so we can override checkParams() function.
-class ProgressParamContext : public ParamContext
+struct ProgressParamContext : public ParamContext
 {
-  public:
     ProgressParamContext(const string &_iniSection)
         : ParamContext(_iniSection) {}
-    void checkParams();
+    void startup();
 };
 
 ProgressParamContext progessMessageParams("progress");
@@ -263,9 +222,8 @@ ProgressParamContext progessMessageParams("progress");
 Param<Tick> progress_interval(&progessMessageParams, "cycle",
                                 "cycle interval for progress messages");
 
-/* check execute options */
 void
-ProgressParamContext::checkParams()
+ProgressParamContext::startup()
 {
     if (progress_interval.isValid())
         new ProgressEvent(&mainEventQueue, progress_interval);