The Sparta Modeling Framework
Loading...
Searching...
No Matches
sparta::serialization::checkpoint::CheckpointBase Class Referenceabstract

Single checkpoint object interface with a tick number and an ID unique to the owning Checkpointer instance. More...

#include <CheckpointBase.hpp>

Inheritance diagram for sparta::serialization::checkpoint::CheckpointBase:

Public Types

Local Types
typedef sparta::Scheduler::Tick tick_t
 tick_t Tick type to which checkpoints will refer
 
typedef uint64_t chkpt_id_t
 tick_t Checkpoint ID type to which checkpoints will refer
 

Public Member Functions

Checkpoint Actions
virtual void load (const std::vector< ArchData * > &dats)=0
 Attempts to restore this checkpoint state to the simulation state (ArchData) objects given to this Checkpoint at construction.
 
tick_t getTick () const noexcept
 Returns the tick number at which this checkpoint was taken.
 
chkpt_id_t getID () const noexcept
 Returns the ID of this checkpoint.
 
virtual chkpt_id_t getPrevID () const =0
 Get the ID of our previous checkpoint. Returns UNIDENTIFIED_CHECKPOINT only for the head checkpoint.
 
virtual std::vector< chkpt_id_tgetNextIDs () const =0
 Returns next checkpoint following *this. May be an empty vector if there are no later checkpoints.
 
virtual std::string getDeletedRepr () const
 Gets the representation of this deleted checkpoint as part of a checkpoint chain (if that checkpointer supports deletion)
 

Static Public Attributes

static const chkpt_id_t MIN_CHECKPOINT = 0
 Indicates the smallest valid checkpoint id.
 
static const chkpt_id_t UNIDENTIFIED_CHECKPOINT = ~(chkpt_id_t)0
 Indicates unidentified checkpoint (could mean 'invalid' or 'any') depending on context.
 

Protected Member Functions

void setID_ (chkpt_id_t id)
 Sets the checkpoint ID.
 

Construction & Initialization

 CheckpointBase (const CheckpointBase &)=delete
 Not copy constructable.
 
CheckpointBaseoperator= (const CheckpointBase &)=delete
 Non-assignable.
 
 CheckpointBase (CheckpointBase &&)=delete
 Not move constructable.
 
CheckpointBaseoperator= (CheckpointBase &&)=delete
 Not move assignable.
 
virtual ~CheckpointBase ()=default
 Destructor.
 
template<typename Archive >
void serialize (Archive &ar, const unsigned int)
 boost::serialization support
 
virtual std::string stringize () const
 Returns a string describing this object.
 
virtual void dumpData (std::ostream &o) const =0
 Writes all checkpoint raw data to an ostream.
 
virtual uint64_t getTotalMemoryUse () const noexcept=0
 Returns memory usage by this checkpoint including any framework data structures.
 
virtual uint64_t getContentMemoryUse () const noexcept=0
 Returns memory usage by this checkpoint solely for the checkpointed content.
 
 CheckpointBase (chkpt_id_t id, tick_t tick)
 

Detailed Description

Single checkpoint object interface with a tick number and an ID unique to the owning Checkpointer instance.

A subclass of Checkpointer is expected to hold or refer to some checkpoint data in memory or on disk at construction which can be restored with load()

Definition at line 25 of file CheckpointBase.hpp.

Member Typedef Documentation

◆ chkpt_id_t

tick_t Checkpoint ID type to which checkpoints will refer

Definition at line 37 of file CheckpointBase.hpp.

◆ tick_t

tick_t Tick type to which checkpoints will refer

Definition at line 34 of file CheckpointBase.hpp.

Constructor & Destructor Documentation

◆ CheckpointBase()

sparta::serialization::checkpoint::CheckpointBase::CheckpointBase ( chkpt_id_t id,
tick_t tick )
inlineprotected
Note
Should only be constructed by subclasses

Definition at line 75 of file CheckpointBase.hpp.

Member Function Documentation

◆ dumpData()

virtual void sparta::serialization::checkpoint::CheckpointBase::dumpData ( std::ostream & o) const
pure virtual

Writes all checkpoint raw data to an ostream.

Parameters
oostream to which raw data will be written
Note
No newlines or other extra characters will be appended

Implemented in sparta::serialization::checkpoint::DatabaseCheckpoint, and sparta::serialization::checkpoint::DeltaCheckpoint< StorageT >.

◆ getContentMemoryUse()

virtual uint64_t sparta::serialization::checkpoint::CheckpointBase::getContentMemoryUse ( ) const
pure virtualnoexcept

Returns memory usage by this checkpoint solely for the checkpointed content.

Implemented in sparta::serialization::checkpoint::DatabaseCheckpoint, and sparta::serialization::checkpoint::DeltaCheckpoint< StorageT >.

◆ getDeletedRepr()

virtual std::string sparta::serialization::checkpoint::CheckpointBase::getDeletedRepr ( ) const
inlinevirtual

Gets the representation of this deleted checkpoint as part of a checkpoint chain (if that checkpointer supports deletion)

Reimplemented in sparta::serialization::checkpoint::DeltaCheckpoint< StorageT >.

Definition at line 166 of file CheckpointBase.hpp.

◆ getID()

chkpt_id_t sparta::serialization::checkpoint::CheckpointBase::getID ( ) const
inlinenoexcept

Returns the ID of this checkpoint.

Note
Number has no sequential meaning - it is effectively a random ID.

Definition at line 148 of file CheckpointBase.hpp.

◆ getNextIDs()

virtual std::vector< chkpt_id_t > sparta::serialization::checkpoint::CheckpointBase::getNextIDs ( ) const
pure virtual

Returns next checkpoint following *this. May be an empty vector if there are no later checkpoints.

Implemented in sparta::serialization::checkpoint::Checkpoint, sparta::serialization::checkpoint::DatabaseCheckpoint, and sparta::serialization::checkpoint::DeltaCheckpoint< StorageT >.

◆ getPrevID()

virtual chkpt_id_t sparta::serialization::checkpoint::CheckpointBase::getPrevID ( ) const
pure virtual

Get the ID of our previous checkpoint. Returns UNIDENTIFIED_CHECKPOINT only for the head checkpoint.

Implemented in sparta::serialization::checkpoint::Checkpoint, sparta::serialization::checkpoint::DatabaseCheckpoint, and sparta::serialization::checkpoint::DeltaCheckpoint< StorageT >.

◆ getTick()

tick_t sparta::serialization::checkpoint::CheckpointBase::getTick ( ) const
inlinenoexcept

Returns the tick number at which this checkpoint was taken.

Definition at line 141 of file CheckpointBase.hpp.

◆ getTotalMemoryUse()

virtual uint64_t sparta::serialization::checkpoint::CheckpointBase::getTotalMemoryUse ( ) const
pure virtualnoexcept

Returns memory usage by this checkpoint including any framework data structures.

Implemented in sparta::serialization::checkpoint::DatabaseCheckpoint, and sparta::serialization::checkpoint::DeltaCheckpoint< StorageT >.

◆ load()

virtual void sparta::serialization::checkpoint::CheckpointBase::load ( const std::vector< ArchData * > & dats)
pure virtual

Attempts to restore this checkpoint state to the simulation state (ArchData) objects given to this Checkpoint at construction.

Implemented in sparta::serialization::checkpoint::DatabaseCheckpoint, and sparta::serialization::checkpoint::DeltaCheckpoint< StorageT >.

◆ serialize()

template<typename Archive >
void sparta::serialization::checkpoint::CheckpointBase::serialize ( Archive & ar,
const unsigned int  )
inline

boost::serialization support

Definition at line 93 of file CheckpointBase.hpp.

◆ setID_()

void sparta::serialization::checkpoint::CheckpointBase::setID_ ( chkpt_id_t id)
inlineprotected

Sets the checkpoint ID.

Definition at line 177 of file CheckpointBase.hpp.

◆ stringize()

virtual std::string sparta::serialization::checkpoint::CheckpointBase::stringize ( ) const
inlinevirtual

Returns a string describing this object.

Reimplemented in sparta::serialization::checkpoint::DatabaseCheckpoint, and sparta::serialization::checkpoint::DeltaCheckpoint< StorageT >.

Definition at line 101 of file CheckpointBase.hpp.

Here is the call graph for this function:

Member Data Documentation

◆ MIN_CHECKPOINT

const chkpt_id_t sparta::serialization::checkpoint::CheckpointBase::MIN_CHECKPOINT = 0
static

Indicates the smallest valid checkpoint id.

Definition at line 45 of file CheckpointBase.hpp.

◆ UNIDENTIFIED_CHECKPOINT

const chkpt_id_t sparta::serialization::checkpoint::CheckpointBase::UNIDENTIFIED_CHECKPOINT = ~(chkpt_id_t)0
static

Indicates unidentified checkpoint (could mean 'invalid' or 'any') depending on context.

Definition at line 51 of file CheckpointBase.hpp.


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