gem5
v20.1.0.0
|
#include <drain.hh>
Public Member Functions | |
bool | tryDrain () |
Try to drain the system. More... | |
void | resume () |
Resume normal simulation in a Drained system. More... | |
void | preCheckpointRestore () |
Run state fixups before a checkpoint restore operation. More... | |
bool | isDrained () const |
Check if the system is drained. More... | |
DrainState | state () const |
Get the simulators global drain state. More... | |
void | signalDrainDone () |
Notify the DrainManager that a Drainable object has finished draining. More... | |
void | registerDrainable (Drainable *obj) |
void | unregisterDrainable (Drainable *obj) |
Static Public Member Functions | |
static DrainManager & | instance () |
Get the singleton DrainManager instance. More... | |
Private Member Functions | |
DrainManager () | |
DrainManager (DrainManager &)=delete | |
~DrainManager () | |
bool | allInState (DrainState state) const |
Helper function to check if all Drainable objects are in a specific state. More... | |
size_t | drainableCount () const |
Thread-safe helper function to get the number of Drainable objects in a system. More... | |
Private Attributes | |
std::mutex | globalLock |
Lock protecting the set of drainable objects. More... | |
std::vector< Drainable * > | _allDrainable |
Set of all drainable objects. More... | |
std::atomic_uint | _count |
Number of objects still draining. More... | |
DrainState | _state |
Global simulator drain state. More... | |
Static Private Attributes | |
static DrainManager | _instance |
Singleton instance of the drain manager. More... | |
|
privatedelete |
|
private |
|
private |
Thread-safe helper function to get the number of Drainable objects in a system.
Definition at line 186 of file drain.cc.
References _allDrainable, globalLock, and X86ISA::lock.
Referenced by preCheckpointRestore(), resume(), signalDrainDone(), and tryDrain().
|
inlinestatic |
Get the singleton DrainManager instance.
Definition at line 87 of file drain.hh.
References _instance.
Referenced by CxxConfigManager::drain(), CxxConfigManager::drainResume(), and init_drain().
void DrainManager::registerDrainable | ( | Drainable * | obj | ) |
Definition at line 157 of file drain.cc.
References _allDrainable, globalLock, and X86ISA::lock.
Referenced by Drainable::Drainable().
void DrainManager::unregisterDrainable | ( | Drainable * | obj | ) |
Definition at line 166 of file drain.cc.
References _allDrainable, globalLock, and X86ISA::lock.
Referenced by Drainable::~Drainable().
|
private |
Set of all drainable objects.
Definition at line 179 of file drain.hh.
Referenced by allInState(), drainableCount(), preCheckpointRestore(), registerDrainable(), resume(), tryDrain(), and unregisterDrainable().
|
private |
Number of objects still draining.
This is flagged atomic since it can be manipulated by SimObjects living in different threads.
Definition at line 186 of file drain.hh.
Referenced by resume(), signalDrainDone(), and tryDrain().
|
staticprivate |
Singleton instance of the drain manager.
Definition at line 192 of file drain.hh.
Referenced by instance().
|
private |
Global simulator drain state.
Definition at line 189 of file drain.hh.
Referenced by isDrained(), preCheckpointRestore(), resume(), state(), and tryDrain().
|
mutableprivate |
Lock protecting the set of drainable objects.
Definition at line 176 of file drain.hh.
Referenced by drainableCount(), registerDrainable(), and unregisterDrainable().