45#include "debug/TimeSync.hh"
60 : statistics::
Group(nullptr),
62 "Number of seconds simulated"),
64 "Number of ticks simulated"),
66 "Number of ticks from beginning of simulation "
67 "(restored from checkpoints and never reset)"),
69 statistics::units::
Tick, statistics::units::Second>::get(),
70 "The number of ticks per simulated second"),
72 "Real time elapsed on the host"),
73 ADD_STAT(hostTickRate, statistics::units::Rate<
74 statistics::units::
Tick, statistics::units::Second>::get(),
75 "The number of ticks simulated per host second (ticks/s)"),
76 ADD_STAT(hostMemory, statistics::units::Byte::get(),
77 "Number of bytes of host memory used"),
129 Time remainder = period - diff;
131 DPRINTF(TimeSync,
"Sleeping to sync with real time.\n");
137 }
while (diff < period);
182 _period.setTick(
p.time_sync_period);
183 _spinThreshold.setTick(
p.time_sync_spin_threshold);
185 assert(_root == NULL);
224RootParams::create()
const
226 static bool created =
false;
228 panic(
"only one root object allowed!");
235 return new Root(*
this, 0);
void setCurTick(Tick newVal)
EventFunctionWrapper syncEvent
const Time timeSyncSpinThreshold() const
Retrieve the threshold for time remaining to spin wait.
void serialize(CheckpointOut &cp) const override
Serialize an object.
bool timeSyncEnabled() const
Check whether time syncing is enabled.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Root(const Params &p, int)
void timeSyncEnable(bool en)
Enable or disable time syncing.
const Time timeSyncPeriod() const
Retrieve the period for the sync event.
void startup() override
Schedule the timesync event at startup().
Abstract superclass for simulation objects.
Tick getTick() const
Get the current time from a value measured in Ticks.
void setTimer()
Use this to set time for the purposes of time measurement (use a monotonic clock if it is available.
Derived & precision(int _precision)
Set the precision and marks this stat to print at the end of simulation.
Derived & prereq(const Stat &prereq)
Set the prerequisite stat and marks this stat to print at the end of simulation.
Derived & scalar(T &value)
Derived & functor(const T &func)
#define ADD_STAT(n,...)
Convenience macro to add a stat to a statistics group.
void deschedule(Event &event)
void schedule(Event &event, Tick when)
#define panic(...)
This implements a cprintf based panic() function.
void serializeSection(CheckpointOut &cp, const char *name) const
Serialize an object into a new section.
void unserializeSection(CheckpointIn &cp, const char *name)
Unserialize an a child object.
const Params & params() const
virtual void resetStats()
Callback to reset stats.
Tick Frequency
The simulated frequency of curTick(). (In ticks per second)
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
unsigned int FullSystemInt
In addition to the boolean flag we make use of an unsigned int since the CPU instruction decoder make...
Tick simQuantum
Simulation Quantum for multiple eventq simulation.
Root::RootStats & rootStats
Global simulator statistics that are not associated with a specific SimObject.
statistics::Value & hostSeconds
uint64_t memUsage()
Determine the simulator process' total virtual memory usage.
Tick curTick()
The universal simulation clock.
std::ostream CheckpointOut
bool FullSystem
The FullSystem variable can be used to determine the current mode of simulation.
uint64_t Tick
Tick count type.
void sleep(const Time &time)
uint32_t numMainEventQueues
Current number of allocated main event queues.
statistics::Value & simTicks
statistics::Formula & simSeconds
statistics::Value & simFreq
std::vector< EventQueue * > mainEventQueue
Array for main event queues.
#define SERIALIZE_SCALAR(scalar)
statistics::Value hostSeconds
statistics::Formula simSeconds
statistics::Value finalTick
void resetStats() override
Callback to reset stats.
statistics::Value simTicks
statistics::Formula hostTickRate
statistics::Value simFreq
static RootStats instance
statistics::Value hostMemory
const std::string & name()