6#include <boost/serialization/export.hpp>
9#include <boost/archive/binary_oarchive.hpp>
10#include <boost/archive/binary_iarchive.hpp>
23std::pair<size_t, size_t> snap_blob_sig(
const T& obj) {
24 std::ostringstream oss(std::ios::binary);
25 boost::archive::binary_oarchive oa(oss);
27 const std::string blob = oss.str();
28 return {blob.size(), std::hash<std::string>{}(blob)};
52 static const bool snap_prof = getenv(
"ADSIDAC_SNAPSHOT_PROFILE") !=
nullptr;
53 auto timed = [](
const char* name,
auto&& copy_fn,
auto&& sig_fn) {
54 if (!snap_prof) { copy_fn();
return; }
55 auto t0 = std::chrono::steady_clock::now();
57 auto us = std::chrono::duration_cast<std::chrono::microseconds>(
58 std::chrono::steady_clock::now() - t0).count();
60 fprintf(stderr,
"[SNAP-PROF] %s copy_us=%lld bytes=%zu hash=%zx\n",
61 name,
static_cast<long long>(us), sig.first, sig.second);
66 timed(
"CommandControlCenter",
69 timed(
"AnalysisInfoContainer",
75 timed(
"InitiatingEventController",
77 [&]{
return snap_blob_sig(
r_IE); });
84 timed(
"HWReliabilityModule",
88 timed(
"KeyParameterHistory",
90 [&]{
return snap_blob_sig(
r_KPS); });
91 timed(
"CalculationAid",
98 auto whole = snap_blob_sig(*
this);
99 fprintf(stderr,
"[SNAP-PROF] WHOLE_RINFO copy_us=0 bytes=%zu hash=%zx\n",
100 whole.first, whole.second);
Checkpoint/restart state snapshot — captures entire C++ simulation state at a branching point.
SimulationContext g_sim
Global simulation context: the single instance, defined in SimulationContext.cpp.
Single struct holding all mutable simulation state.
void copyAnalysisInfoContainer(AnalysisInfoContainer &)
int getIDOfRecentGeneratedBranchCluster()
void copyCalculationAidToRestartInfoForRestart(const CalculationAid &)
void copyCommandControlCenterToRestartInfo(CommandControlCenter &)
void clearCommandControlCenteFromRestartInfo()
void copyControlPanel(ControlPanel &)
void copyHWReliabilityModule(HWReliabilityModule &)
Appends deep copies of the units of another module and copies its state of activation....
void copyInitiatingEventController(InitiatingEventController &)
void copyKeyParameterHistory(KeyParameterHistory &)
void copyOperatorATToRestartInfo(OperatorAT &)
void clearOperatorATFromRestartInfo()
void copyOperatorDMToRestartInfo(OperatorDM &)
void clearOperatorDMFromRestartInfo()
void copyProceduresToRestartInfoForRestart(Procedures &)
void setCorrespondingBranchClusterID(int)
CommandControlCenter r_Command_handler
InitiatingEventController r_IE
OperatorAT r_Action_Taker
HWReliabilityModule r_System_reliability
void saveRestartNodeInfo()
CalculationAid r_All_polynomial
OperatorDM r_Decision_Maker
Procedures r_All_procedure
AnalysisInfoContainer r_Aux_info
KeyParameterHistory r_KPS
int corresponding_branch_cluster_ID
int getCorrespondingBranchClusterID()
virtual ~RestartNodeInfo()
Procedures All_procedure
Emergency operating procedures.
OperatorAT Action_Taker
Crew action execution model.
KeyParameterHistory KPS
Time-series parameter recording.
ControlPanel Indicator
Control room panel state.
HWReliabilityModule System_reliability
Hardware fault trees.
OperatorDM Decision_Maker
Crew decision-making model.
CommandControlCenter Command_handler
Command/control dispatch.
InitiatingEventController IE
Initiating event definition.
AnalysisInfoContainer Aux_info
Analysis records.
BranchRecord Branch_center
Dynamic event tree state.
CalculationAid All_polynomial
Polynomial calculations.