gem5  v20.1.0.0
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
DrainManager Class Reference

#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 DrainManagerinstance ()
 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...
 

Detailed Description

Definition at line 78 of file drain.hh.

Constructor & Destructor Documentation

◆ DrainManager() [1/2]

DrainManager::DrainManager ( )
private

Definition at line 50 of file drain.cc.

References Running.

◆ DrainManager() [2/2]

DrainManager::DrainManager ( DrainManager )
privatedelete

◆ ~DrainManager()

DrainManager::~DrainManager ( )
private

Definition at line 56 of file drain.cc.

Member Function Documentation

◆ allInState()

bool DrainManager::allInState ( DrainState  state) const
private

Helper function to check if all Drainable objects are in a specific state.

Definition at line 175 of file drain.cc.

References _allDrainable, and state().

Referenced by resume().

◆ drainableCount()

size_t DrainManager::drainableCount ( ) const
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().

◆ instance()

static DrainManager& DrainManager::instance ( )
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().

◆ registerDrainable()

void DrainManager::registerDrainable ( Drainable obj)

Definition at line 157 of file drain.cc.

References _allDrainable, globalLock, and X86ISA::lock.

Referenced by Drainable::Drainable().

◆ unregisterDrainable()

void DrainManager::unregisterDrainable ( Drainable obj)

Definition at line 166 of file drain.cc.

References _allDrainable, globalLock, and X86ISA::lock.

Referenced by Drainable::~Drainable().

Member Data Documentation

◆ _allDrainable

std::vector<Drainable *> DrainManager::_allDrainable
private

Set of all drainable objects.

Definition at line 179 of file drain.hh.

Referenced by allInState(), drainableCount(), preCheckpointRestore(), registerDrainable(), resume(), tryDrain(), and unregisterDrainable().

◆ _count

std::atomic_uint DrainManager::_count
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().

◆ _instance

DrainManager DrainManager::_instance
staticprivate

Singleton instance of the drain manager.

Definition at line 192 of file drain.hh.

Referenced by instance().

◆ _state

DrainState DrainManager::_state
private

Global simulator drain state.

Definition at line 189 of file drain.hh.

Referenced by isDrained(), preCheckpointRestore(), resume(), state(), and tryDrain().

◆ globalLock

std::mutex DrainManager::globalLock
mutableprivate

Lock protecting the set of drainable objects.

Definition at line 176 of file drain.hh.

Referenced by drainableCount(), registerDrainable(), and unregisterDrainable().


The documentation for this class was generated from the following files:

Generated on Wed Sep 30 2020 14:02:23 for gem5 by doxygen 1.8.17