From 510eef0fa02ffcb123aa450943ce7e08a57d5b06 Mon Sep 17 00:00:00 2001 From: Steve Reinhardt Date: Sun, 11 Jan 2004 15:24:18 -0800 Subject: Modify handling of serialize:dir parameter to make it more useful. Move global checkpoint-related functions and vars into Checkpoint class (as statics). arch/alpha/pseudo_inst.cc: dev/disk_image.cc: Move global checkpoint-related functions and vars into Checkpoint class (as statics). sim/serialize.cc: Move global checkpoint-related functions and vars into Checkpoint class (as statics). Checkpoint constructor now takes checkpoint directory name instead of file name. Make serialize:dir parameter actually set checkpoint directory name instead of directory in which checkpoint directory is created. If the value contains a '%', the curTick value is sprintf'd into the format to create the directory name. The default is backwards compatible with the old fixed name ("m5.%012d"). sim/serialize.hh: Move global checkpoint-related functions and vars into Checkpoint class (as statics). Checkpoint constructor now takes checkpoint directory name instead of file name. --HG-- extra : convert_revision : d0aa87b62911f405a4f5811271b9e6351fdd9fe4 --- sim/serialize.hh | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'sim/serialize.hh') diff --git a/sim/serialize.hh b/sim/serialize.hh index 60e06f94b..32802409d 100644 --- a/sim/serialize.hh +++ b/sim/serialize.hh @@ -207,7 +207,7 @@ class Checkpoint std::map objMap; public: - Checkpoint(const std::string &filename, const std::string &path, + Checkpoint(const std::string &cpt_dir, const std::string &path, const ConfigNode *_configNode); bool find(const std::string §ion, const std::string &entry, @@ -217,14 +217,22 @@ class Checkpoint Serializable *&value); bool sectionExists(const std::string §ion); -}; + // The following static functions have to do with checkpoint + // creation rather than restoration. This class makes a handy + // namespace for them though. -// -// Export checkpoint filename param so other objects can derive -// filenames from it (e.g., memory). -// -std::string CheckpointDir(); -void SetupCheckpoint(Tick when, Tick period = 0); + // Export current checkpoint directory name so other objects can + // derive filenames from it (e.g., memory). The return value is + // guaranteed to end in '/' so filenames can be directly appended. + // This function is only valid while a checkpoint is being created. + static std::string dir(); + + // Filename for base checkpoint file within directory. + static const char *baseFilename; + + // Set up a checkpoint creation event or series of events. + static void setup(Tick when, Tick period = 0); +}; #endif // __SERIALIZE_HH__ -- cgit v1.2.3