diff options
Diffstat (limited to 'sim/serialize.cc')
-rw-r--r-- | sim/serialize.cc | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/sim/serialize.cc b/sim/serialize.cc index 33956c6e7..281e7cfc8 100644 --- a/sim/serialize.cc +++ b/sim/serialize.cc @@ -305,10 +305,9 @@ class SerializeParamContext : public ParamContext SerializeParamContext serialParams("serialize"); -Param<string> serialize_dir(&serialParams, - "dir", +Param<string> serialize_dir(&serialParams, "dir", "dir to stick checkpoint in " - "(sprintf format with cycle #)", "m5.%012d"); + "(sprintf format with cycle #)"); Param<Counter> serialize_cycle(&serialParams, "cycle", @@ -333,11 +332,18 @@ SerializeParamContext::~SerializeParamContext() void SerializeParamContext::checkParams() { - checkpointDirBase = serialize_dir; + if (serialize_dir.isValid()) { + checkpointDirBase = serialize_dir; + } else { + if (outputDirectory.empty()) + checkpointDirBase = "m5.%012d"; + else + checkpointDirBase = outputDirectory + "cpt.%012d"; + } + // guarantee that directory ends with a '/' - if (checkpointDirBase[checkpointDirBase.size() - 1] != '/') { + if (checkpointDirBase[checkpointDirBase.size() - 1] != '/') checkpointDirBase += "/"; - } if (serialize_cycle > 0) Checkpoint::setup(serialize_cycle, serialize_period); |