gem5 v24.0.0.0
Loading...
Searching...
No Matches
gem5::DrainManager Class Reference

#include <drain.hh>

Public Member Functions

bool tryDrain ()
 Try to drain the system.
 
void resume ()
 Resume normal simulation in a Drained system.
 
void preCheckpointRestore ()
 Run state fixups before a checkpoint restore operation.
 
bool isDrained () const
 Check if the system is drained.
 
DrainState state () const
 Get the simulators global drain state.
 
void signalDrainDone ()
 Notify the DrainManager that a Drainable object has finished draining.
 
void registerDrainable (Drainable *obj)
 
void unregisterDrainable (Drainable *obj)
 

Static Public Member Functions

static DrainManagerinstance ()
 Get the singleton DrainManager instance.
 

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.
 
size_t drainableCount () const
 Thread-safe helper function to get the number of Drainable objects in a system.
 

Private Attributes

std::mutex globalLock
 Lock protecting the set of drainable objects.
 
std::vector< Drainable * > _allDrainable
 Set of all drainable objects.
 
std::atomic_uint _count
 Number of objects still draining.
 
DrainState _state
 Global simulator drain state.
 

Static Private Attributes

static DrainManager _instance
 Singleton instance of the drain manager.
 

Detailed Description

Definition at line 82 of file drain.hh.

Constructor & Destructor Documentation

◆ DrainManager() [1/2]

gem5::DrainManager::DrainManager ( )
private

Definition at line 53 of file drain.cc.

◆ DrainManager() [2/2]

gem5::DrainManager::DrainManager ( DrainManager & )
privatedelete

◆ ~DrainManager()

gem5::DrainManager::~DrainManager ( )
private

Definition at line 59 of file drain.cc.

Member Function Documentation

◆ allInState()

bool gem5::DrainManager::allInState ( DrainState state) const
private

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

Definition at line 178 of file drain.cc.

References _allDrainable, and state().

Referenced by resume().

◆ drainableCount()

size_t gem5::DrainManager::drainableCount ( ) const
private

Thread-safe helper function to get the number of Drainable objects in a system.

Definition at line 189 of file drain.cc.

References _allDrainable, globalLock, and gem5::X86ISA::lock.

Referenced by preCheckpointRestore(), resume(), signalDrainDone(), and tryDrain().

◆ instance()

static DrainManager & gem5::DrainManager::instance ( )
inlinestatic

Get the singleton DrainManager instance.

Definition at line 91 of file drain.hh.

References _instance.

Referenced by gem5::CxxConfigManager::drain(), gem5::CxxConfigManager::drainResume(), and gem5::init_drain().

◆ registerDrainable()

void gem5::DrainManager::registerDrainable ( Drainable * obj)

Definition at line 160 of file drain.cc.

References _allDrainable, globalLock, and gem5::X86ISA::lock.

Referenced by gem5::Drainable::Drainable().

◆ unregisterDrainable()

void gem5::DrainManager::unregisterDrainable ( Drainable * obj)

Definition at line 169 of file drain.cc.

References _allDrainable, globalLock, and gem5::X86ISA::lock.

Referenced by gem5::Drainable::~Drainable().

Member Data Documentation

◆ _allDrainable

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

Set of all drainable objects.

Definition at line 183 of file drain.hh.

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

◆ _count

std::atomic_uint gem5::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 190 of file drain.hh.

Referenced by resume(), signalDrainDone(), and tryDrain().

◆ _instance

DrainManager gem5::DrainManager::_instance
staticprivate

Singleton instance of the drain manager.

Definition at line 196 of file drain.hh.

Referenced by instance().

◆ _state

DrainState gem5::DrainManager::_state
private

Global simulator drain state.

Definition at line 193 of file drain.hh.

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

◆ globalLock

std::mutex gem5::DrainManager::globalLock
mutableprivate

Lock protecting the set of drainable objects.

Definition at line 180 of file drain.hh.

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


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

Generated on Tue Jun 18 2024 16:24:10 for gem5 by doxygen 1.11.0