Timesync: Make sure timesync event is setup after curTick is unserialized
Setup initial timesync event in initState or loadState so that curTick has been updated to the new value, otherwise the event is scheduled in the past.
This commit is contained in:
parent
b7457fc11e
commit
59bf0e7eb4
2 changed files with 28 additions and 2 deletions
|
@ -108,7 +108,18 @@ Root::Root(RootParams *p) : SimObject(p), _enabled(false),
|
||||||
assert(_root == NULL);
|
assert(_root == NULL);
|
||||||
_root = this;
|
_root = this;
|
||||||
lastTime.setTimer();
|
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 *
|
Root *
|
||||||
|
|
|
@ -95,7 +95,22 @@ class Root : public SimObject
|
||||||
/// Set the threshold for time remaining to spin wait.
|
/// Set the threshold for time remaining to spin wait.
|
||||||
void timeSyncSpinThreshold(Time newThreshold);
|
void timeSyncSpinThreshold(Time newThreshold);
|
||||||
|
|
||||||
Root(RootParams *p);
|
typedef RootParams Params;
|
||||||
|
const Params *
|
||||||
|
params() const
|
||||||
|
{
|
||||||
|
return dynamic_cast<const Params *>(_params);
|
||||||
|
}
|
||||||
|
|
||||||
|
Root(Params *p);
|
||||||
|
|
||||||
|
/** Schedule the timesync event at loadState() so that curTick is correct
|
||||||
|
*/
|
||||||
|
void loadState(Checkpoint *cp);
|
||||||
|
|
||||||
|
/** Schedule the timesync event at initState() when not unserializing
|
||||||
|
*/
|
||||||
|
void initState();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __SIM_ROOT_HH__
|
#endif // __SIM_ROOT_HH__
|
||||||
|
|
Loading…
Reference in a new issue