gem5
|
Basic support for object serialization. More...
#include <serialize.hh>
Classes | |
class | ScopedCheckpointSection |
Scoped checkpoint section helper class. More... | |
Public Member Functions | |
Serializable () | |
virtual | ~Serializable () |
virtual void | serialize (CheckpointOut &cp) const =0 |
Serialize an object. More... | |
virtual void | unserialize (CheckpointIn &cp)=0 |
Unserialize an object. More... | |
void | serializeSection (CheckpointOut &cp, const char *name) const |
Serialize an object into a new section. More... | |
void | serializeSection (CheckpointOut &cp, const std::string &name) const |
void | unserializeSection (CheckpointIn &cp, const char *name) |
Unserialize an a child object. More... | |
void | unserializeSection (CheckpointIn &cp, const std::string &name) |
Static Public Member Functions | |
static const std::string & | currentSection () |
Get the fully-qualified name of the active section. More... | |
static void | serializeAll (const std::string &cpt_dir) |
static void | unserializeGlobals (CheckpointIn &cp) |
Static Public Attributes | |
static int | ckptCount = 0 |
static int | ckptMaxCount = 0 |
static int | ckptPrevCount = -1 |
Static Private Attributes | |
static std::stack< std::string > | path |
Basic support for object serialization.
Objects that support serialization should derive from this class. Such objects can largely be divided into two categories: 1) True SimObjects (deriving from SimObject), and 2) child objects (non-SimObjects).
SimObjects are serialized automatically into their own sections automatically by the SimObject base class (see SimObject::serializeAll().
SimObjects can contain other serializable objects that are not SimObjects. Much like normal serialized members are not serialized automatically, these objects will not be serialized automatically and it is expected that the objects owning such serializable objects call the required serialization/unserialization methods on child objects. The preferred method to serialize a child object is to call serializeSection() on the child, which serializes the object into a new subsection in the current section. Another option is to call serialize() directly, which serializes the object into the current section. The latter is not recommended as it can lead to naming clashes between objects.
Definition at line 220 of file serialize.hh.
Serializable::Serializable | ( | ) |
Definition at line 569 of file serialize.cc.
|
virtual |
Definition at line 573 of file serialize.cc.
|
static |
Get the fully-qualified name of the active section.
Definition at line 652 of file serialize.cc.
Referenced by arrayParamIn(), Serializable::ScopedCheckpointSection::nameOut(), objParamIn(), optParamIn(), paramIn(), HDLcd::unserialize(), Pl390::unserialize(), and Globals::unserialize().
|
pure virtual |
Serialize an object.
Output an object's state into the current checkpoint section.
cp | Checkpoint state |
Implemented in iGbReg::Regs, DistIface, VirtIODeviceBase, Cache, IGbE, System, IGbE::TxDescCache, Globals, DistIface::RecvScheduler, GenericISA::DelaySlotUPCState< MachInst >, Event, IGbE::RxDescCache, HDLcd::DmaEngine, Pl111, Pl390, NSGigE, IdeDisk, ArmISA::ISA, DistIface::RecvScheduler::Desc, ArmISA::TLB, GenericISA::DelaySlotPCState< MachInst >, X86ISA::PCState, ArmISA::PMU::CounterState, IGbE::DescCache< T >, IGbE::DescCache< iGbReg::TxDesc >, IGbE::DescCache< iGbReg::RxDesc >, DmaReadFifo, VirtQueue, Sinic::Device, X86ISA::Interrupts, ArmISA::TlbEntry, GenericTimerMem, DistIface::SyncSwitch, ArmISA::Interrupts, BasePixelPump::PixelEvent, FrameBuffer, GenericISA::UPCState< MachInst >, X86ISA::I8042, X86ISA::GpuTLB, SparcISA::Interrupts, PhysicalMemory, ClockedObject, FuncPageTable, SrcClockDomain, TrafficGen, DistEtherLink, DistIface::SyncNode, VirtIO9PProxy, PciDevice, VGic, RealViewOsc, SimObject, CopyEngine, DeviceFDEntry, GenericTimer, TickedObject, DistIface::Sync, CopyEngineReg::ChanRegs, VGic, ArchTimer, EtherSwitch, CpuLocalTimer, RealViewCtrl, MuxingKvmGic, Pl390::BankedRegs, SparcISA::TLB, UFSHostDevice, DVFSHandler, PowerISA::TLB, PipeFDEntry, SparcISA::ISA, Ticked, EtherSwitch::Interface::PortFifo, EtherTapStub, ThermalModel, Pl050, Sp804, EtherLink, SimpleThread, IdeController, BasePixelPump, MultiLevelPageTable< ISAOps >, I2CBus, CpuLocalTimer::Timer, X86ISA::TLB, AlphaISA::TlbEntry, Iob, TsunamiIO, MaltaCChip, CowDiskImage, EnergyCtrl, TsunamiCChip, MaltaIO, Malta, ThermalReference, VoltageDomain, PL031, CopyEngineReg::Regs, FileFDEntry, AlphaISA::Interrupts, Sp804::Timer, AlphaBackdoor, AlphaISA::TLB, EtherSwitch::Interface::PortFifoEntry, Uart8250, O3ThreadState< class >, Root, O3ThreadState< Impl >, X86ISA::I82094AA, GpuDispatcher, MipsISA::Interrupts, CopyEngine::CopyEngineChannel, X86ISA::I8254, X86ISA::I8259, MipsISA::TLB, RiscvISA::TLB, GenericISA::PCStateBase, Random, HDLcd, X86ISA::ISA, RubySystem, ArmISA::PMU, ThermalDomain, DistEtherLink::Link, SystemCounter, ThermalCapacitor, AlphaISA::ISA, LocalSimLoopExitEvent, EtherSwitch::Interface, AlphaISA::Kernel::Statistics, Tsunami, X86ISA::Cmos, AlphaBackdoor::Access, Kernel::Statistics, TsunamiPChip, Sinic::Base, X86ISA::Speaker, EtherTapBase, FlashDevice, Process, ThermalResistor, ThreadState, DisplayTimings, DumbTOD, MmDisk, FDEntry, PollEvent, Pl011, X86ISA::I8237, and NoMaliGpu.
Referenced by Process::serialize().
|
static |
Definition at line 592 of file serialize.cc.
References CheckpointIn::baseFilename, fatal, globals, SimObject::serializeAll(), serializeSection(), CheckpointIn::setDir(), and ArmISA::t.
Referenced by debug_serialize(), and pybind_init_core().
void Serializable::serializeSection | ( | CheckpointOut & | cp, |
const char * | name | ||
) | const |
Serialize an object into a new section.
This method creates a new section in a checkpoint and calls serialize() to serialize the current object into that section. The name of the section is appended to the current checkpoint path.
cp | Checkpoint state |
name | Name to append to the active path |
Definition at line 578 of file serialize.cc.
References X86ISA::serialize().
Referenced by ArmISA::PMU::serialize(), AlphaISA::TLB::serialize(), Sp804::serialize(), CpuLocalTimer::serialize(), VGic::serialize(), GenericTimer::serialize(), CopyEngine::serialize(), DistEtherLink::serialize(), GenericTimerMem::serialize(), ArmISA::TLB::serialize(), System::serialize(), IGbE::serialize(), VirtIODeviceBase::serialize(), DistIface::serialize(), SimObject::serializeAll(), serializeAll(), and serializeSection().
|
inline |
Definition at line 304 of file serialize.hh.
References serializeSection().
|
pure virtual |
Unserialize an object.
Read an object's state from the current checkpoint section.
cp | Checkpoint state |
Implemented in iGbReg::Regs, DistIface, VirtIODeviceBase, Cache, IGbE, System, IGbE::TxDescCache, Globals, DistIface::RecvScheduler, GenericISA::DelaySlotUPCState< MachInst >, Event, IGbE::RxDescCache, HDLcd::DmaEngine, Pl111, ArmISA::ISA, Pl390, NSGigE, IdeDisk, DistIface::RecvScheduler::Desc, ArmISA::TLB, GenericISA::DelaySlotPCState< MachInst >, X86ISA::PCState, ArmISA::PMU::CounterState, IGbE::DescCache< T >, IGbE::DescCache< iGbReg::TxDesc >, IGbE::DescCache< iGbReg::RxDesc >, DmaReadFifo, VirtQueue, ArmISA::TlbEntry, Sinic::Device, X86ISA::Interrupts, GenericTimerMem, DistIface::SyncSwitch, ArmISA::Interrupts, BasePixelPump::PixelEvent, GenericISA::UPCState< MachInst >, PhysicalMemory, FrameBuffer, SparcISA::Interrupts, X86ISA::I8042, X86ISA::GpuTLB, ClockedObject, FuncPageTable, SrcClockDomain, TrafficGen, DistEtherLink, DistIface::SyncNode, PciDevice, VirtIO9PProxy, VGic, RealViewOsc, CopyEngineReg::ChanRegs, SimObject, CopyEngine, DeviceFDEntry, GenericTimer, TickedObject, DistIface::Sync, VGic, ArchTimer, EtherSwitch, CpuLocalTimer, RealViewCtrl, MuxingKvmGic, Pl390::BankedRegs, SparcISA::TLB, UFSHostDevice, DVFSHandler, PowerISA::TLB, PipeFDEntry, SparcISA::ISA, Ticked, EtherSwitch::Interface::PortFifo, EtherTapStub, ThermalModel, Pl050, Sp804, EtherLink, SimpleThread, IdeController, BasePixelPump, MultiLevelPageTable< ISAOps >, I2CBus, CpuLocalTimer::Timer, X86ISA::TLB, AlphaISA::TlbEntry, Iob, TsunamiIO, MaltaCChip, CowDiskImage, EnergyCtrl, CopyEngineReg::Regs, TsunamiCChip, MaltaIO, Malta, ThermalReference, VoltageDomain, AlphaISA::Interrupts, PL031, FileFDEntry, Sp804::Timer, O3ThreadState< class >, O3ThreadState< Impl >, AlphaBackdoor, AlphaISA::TLB, MipsISA::Interrupts, EtherSwitch::Interface::PortFifoEntry, Uart8250, Root, GenericISA::PCStateBase, X86ISA::I82094AA, GpuDispatcher, CopyEngine::CopyEngineChannel, X86ISA::I8254, X86ISA::I8259, MipsISA::TLB, RiscvISA::TLB, Random, HDLcd, X86ISA::ISA, RubySystem, ArmISA::PMU, ThermalDomain, DistEtherLink::Link, SystemCounter, ThermalCapacitor, AlphaISA::ISA, LocalSimLoopExitEvent, EtherSwitch::Interface, AlphaISA::Kernel::Statistics, Tsunami, X86ISA::Cmos, AlphaBackdoor::Access, Kernel::Statistics, TsunamiPChip, Sinic::Base, X86ISA::Speaker, EtherTapBase, FlashDevice, Process, ThreadState, ThermalResistor, DisplayTimings, DumbTOD, FDEntry, PollEvent, Pl011, X86ISA::I8237, and NoMaliGpu.
Referenced by Process::unserialize().
|
static |
Definition at line 611 of file serialize.cc.
References globals, ArmISA::i, mainEventQueue, numMainEventQueues, Globals::unserializedCurTick, and unserializeSection().
Referenced by pybind_init_core().
void Serializable::unserializeSection | ( | CheckpointIn & | cp, |
const char * | name | ||
) |
Unserialize an a child object.
This method loads a child object from a checkpoint. The object name is appended to the active path to form a fully qualified section name and unserialize() is called.
cp | Checkpoint state |
name | Name to append to the active path |
Definition at line 585 of file serialize.cc.
References X86ISA::unserialize().
Referenced by SimObject::loadState(), ArmISA::PMU::unserialize(), Sp804::unserialize(), EtherSwitch::Interface::PortFifo::unserialize(), CpuLocalTimer::unserialize(), GenericTimer::unserialize(), CopyEngine::unserialize(), DistEtherLink::unserialize(), GenericTimerMem::unserialize(), ArmISA::TLB::unserialize(), DistIface::RecvScheduler::unserialize(), System::unserialize(), IGbE::unserialize(), VirtIODeviceBase::unserialize(), DistIface::unserialize(), unserializeGlobals(), and unserializeSection().
|
inline |
Definition at line 320 of file serialize.hh.
References unserializeSection().
|
static |
Definition at line 327 of file serialize.hh.
|
static |
Definition at line 328 of file serialize.hh.
|
static |
Definition at line 329 of file serialize.hh.
|
staticprivate |
Definition at line 334 of file serialize.hh.
Referenced by MathExprPowerModel::MathExprPowerModel().