Automated merge with ssh://repo.gem5.org/gem5
[gem5.git] / src / sim / root.cc
index d44c72f4dbc07cef4a447024ec39d25819d0c2d5..dd7c1207711fa822ae84dc346d127a2d0897a796 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2002-2005 The Regents of The University of Michigan
- * Copyright (c) 2011 Advanced Micro Devices
+ * Copyright (c) 2011 Advanced Micro Devices, Inc.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -32,7 +32,7 @@
  */
 
 #include "base/misc.hh"
-#include "sim/core.hh"
+#include "debug/TimeSync.hh"
 #include "sim/root.hh"
 
 Root *Root::_root = NULL;
@@ -87,8 +87,7 @@ Root::timeSyncPeriod(Time newPeriod)
 {
     bool en = timeSyncEnabled();
     _period = newPeriod;
-    _periodTick = _period.nsec() * SimClock::Int::ns +
-                  _period.sec() * SimClock::Int::s;
+    _periodTick = _period.getTick();
     timeSyncEnable(en);
 }
 
@@ -104,16 +103,24 @@ Root::timeSyncSpinThreshold(Time newThreshold)
 Root::Root(RootParams *p) : SimObject(p), _enabled(false),
     _periodTick(p->time_sync_period), syncEvent(this)
 {
-    uint64_t nsecs = p->time_sync_period / SimClock::Int::ns;
-    _period.set(nsecs / Time::NSEC_PER_SEC, nsecs % Time::NSEC_PER_SEC);
-    nsecs = p->time_sync_spin_threshold / SimClock::Int::ns;
-    _spinThreshold.set(nsecs / Time::NSEC_PER_SEC,
-            nsecs % Time::NSEC_PER_SEC);
+    _period.setTick(p->time_sync_period);
+    _spinThreshold.setTick(p->time_sync_spin_threshold);
 
     assert(_root == NULL);
     _root = this;
     lastTime.setTimer();
-    timeSyncEnable(p->time_sync_enable);
+}
+
+void
+Root::initState()
+{
+    timeSyncEnable(params()->time_sync_enable);
+}
+
+void
+Root::loadState(Checkpoint *cp)
+{
+    timeSyncEnable(params()->time_sync_enable);
 }
 
 Root *