5#include "sparta/serialization/checkpoint/CheckpointBase.hpp"
7#include "sparta/serialization/checkpoint/VectorStorage.hpp"
9namespace sparta::serialization::checkpoint
11 class DatabaseCheckpointer;
12 class DatabaseCheckpoint;
23 std::vector<std::shared_ptr<DatabaseCheckpoint>> chkpts;
26 uint64_t start_tick = 0;
27 uint64_t end_tick = 0;
31 template <
typename Archive>
32 void serialize(Archive& ar,
const unsigned int );
40 std::vector<char> chkpt_bytes;
43 uint64_t start_tick = 0;
44 uint64_t end_tick = 0;
96 template <
typename Archive>
97 void serialize(Archive& ar,
const unsigned int version) {
200 void storeSnapshot_(const std::vector<
ArchData*>& dats);
210 void storeDelta_(const std::vector<
ArchData*>& dats);
226 storage::VectorStorage data_;
236 template <typename Archive>
237 inline
void ChkptWindow::serialize(Archive& ar, const
unsigned int ) {
243 if (chkpts.empty()) {
245 const auto num_chkpts = end_chkpt_id - start_chkpt_id + 1;
246 for (size_t i = 0; i < num_chkpts; ++i) {
247 chkpts.emplace_back(new DatabaseCheckpoint);
252 for (
auto& chkpt : chkpts) {
File that contains checkpoint exception types.
Contains a set of contiguous line of architectural data which can be referred to by any architected o...
Single checkpoint object interface with a tick number and an ID unique to the owning Checkpointer ins...
uint64_t chkpt_id_t
tick_t Checkpoint ID type to which checkpoints will refer
void serialize(Archive &ar, const unsigned int)
boost::serialization support
static const chkpt_id_t UNIDENTIFIED_CHECKPOINT
Indicates unidentified checkpoint (could mean 'invalid' or 'any') depending on context.
sparta::Scheduler::Tick tick_t
tick_t Tick type to which checkpoints will refer
Checkpoint class optimized for use with database-backed checkpointers.
bool isSnapshot() const noexcept
Is this checkpoint a snapshot? If true, this checkpoint has no dependencies and contains all simulato...
std::stack< chkpt_id_t > getRestoreChain() const
Returns a stack of checkpoints that must be restored from top-to-bottom to fully restore the state as...
void loadState(const std::vector< ArchData * > &dats)
Loads delta state of this checkpoint to root.
std::string stringize() const override
Returns a string describing this object.
std::stack< chkpt_id_t > getHistoryChain() const
Returns a stack of checkpoints from this checkpoint as far back as possible until no previous link is...
uint32_t getDistanceToPrevSnapshot() const noexcept
Determines how many checkpoints away the closest, earlier snapshot is.
uint64_t getTotalMemoryUse() const noexcept override
Returns memory usage by this checkpoint.
uint64_t getContentMemoryUse() const noexcept override
Returns memory usage by the content of this checkpoint.
void dumpData(std::ostream &o) const override
Writes all checkpoint raw data to an ostream.
DatabaseCheckpoint(const DatabaseCheckpoint &)=delete
Not copy constructable.
chkpt_id_t getPrevID() const override
Get the ID of our previous checkpoint. Returns UNIDENTIFIED_CHECKPOINT only for the head checkpoint.
DatabaseCheckpoint & operator=(DatabaseCheckpoint &&)=delete
Not move assignable.
DatabaseCheckpoint & operator=(const DatabaseCheckpoint &)=delete
Non-assignable.
std::vector< chkpt_id_t > getNextIDs() const override
Returns next checkpoints following this one. May be an empty vector if there are no later checkpoints...
DatabaseCheckpoint(DatabaseCheckpoint &&)=delete
Not move constructable.
void load(const std::vector< ArchData * > &dats) override
Attempts to restore this checkpoint including any previous deltas (dependencies).
Implementation of the FastCheckpointer which only holds a subset of checkpoints in memory at any give...
Compressed version of ChkptWindow to be stored in the database.
A window of checkpoints to be sent to/from the database as a unit.
void serialize(Archive &ar, const unsigned int)
Support boost::serialization.