summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Lim <ktlim@umich.edu>2006-07-07 16:46:08 -0400
committerKevin Lim <ktlim@umich.edu>2006-07-07 16:46:08 -0400
commit1faada9bd98a6425624a97813d4c8cdc5b78aa1f (patch)
tree162d9d5f008e69edb60e4edae9250803b7ea36ed
parent018ba50f2c05e07c7bd1c951db8ba33402c323dc (diff)
downloadgem5-1faada9bd98a6425624a97813d4c8cdc5b78aa1f.tar.xz
Take the name of the checkpoint directory in when calling checkpoint() or restoreCheckpoint().
src/sim/main.cc: src/sim/serialize.cc: src/sim/serialize.hh: Take in the directory name when checkpointing. --HG-- extra : convert_revision : 040e828622480f1051e2156f4439e24864c38d45
-rw-r--r--src/python/m5/__init__.py10
-rw-r--r--src/sim/main.cc8
-rw-r--r--src/sim/serialize.cc10
-rw-r--r--src/sim/serialize.hh6
4 files changed, 18 insertions, 16 deletions
diff --git a/src/python/m5/__init__.py b/src/python/m5/__init__.py
index dc3af7000..f4f5be2d1 100644
--- a/src/python/m5/__init__.py
+++ b/src/python/m5/__init__.py
@@ -34,7 +34,7 @@ import cc_main
# import a few SWIG-wrapped items (those that are likely to be used
# directly by user scripts) completely into this module for
# convenience
-from cc_main import simulate, SimLoopExitEvent, setCheckpointDir
+from cc_main import simulate, SimLoopExitEvent
# import the m5 compile options
import defines
@@ -239,17 +239,17 @@ def drain(root):
def resume(root):
root.resume()
-def checkpoint(root):
+def checkpoint(root, dir):
if not isinstance(root, objects.Root):
raise TypeError, "Object is not a root object. Checkpoint must be called on a root object."
doDrain(root)
print "Writing checkpoint"
- cc_main.serializeAll()
+ cc_main.serializeAll(dir)
resume(root)
-def restoreCheckpoint(root):
+def restoreCheckpoint(root, dir):
print "Restoring from checkpoint"
- cc_main.unserializeAll()
+ cc_main.unserializeAll(dir)
resume(root)
def changeToAtomic(system):
diff --git a/src/sim/main.cc b/src/sim/main.cc
index e96a44930..5f34f6520 100644
--- a/src/sim/main.cc
+++ b/src/sim/main.cc
@@ -542,15 +542,15 @@ cleanupCountedDrain(Event *counted_drain)
}
void
-serializeAll()
+serializeAll(const std::string &cpt_dir)
{
- Serializable::serializeAll();
+ Serializable::serializeAll(cpt_dir);
}
void
-unserializeAll()
+unserializeAll(const std::string &cpt_dir)
{
- Serializable::unserializeAll();
+ Serializable::unserializeAll(cpt_dir);
}
/**
diff --git a/src/sim/serialize.cc b/src/sim/serialize.cc
index 7450d7b7e..6a1d084b7 100644
--- a/src/sim/serialize.cc
+++ b/src/sim/serialize.cc
@@ -231,8 +231,9 @@ Globals::unserialize(Checkpoint *cp)
}
void
-Serializable::serializeAll()
+Serializable::serializeAll(const std::string &cpt_dir)
{
+ setCheckpointDir(cpt_dir);
string dir = Checkpoint::dir();
if (mkdir(dir.c_str(), 0775) == -1 && errno != EEXIST)
fatal("couldn't mkdir %s\n", dir);
@@ -247,8 +248,9 @@ Serializable::serializeAll()
}
void
-Serializable::unserializeAll()
+Serializable::unserializeAll(const std::string &cpt_dir)
{
+ setCheckpointDir(cpt_dir);
string dir = Checkpoint::dir();
string cpt_file = dir + Checkpoint::baseFilename;
string section = "";
@@ -289,9 +291,9 @@ Checkpoint::dir()
}
void
-debug_serialize()
+debug_serialize(const std::string &cpt_dir)
{
- Serializable::serializeAll();
+ Serializable::serializeAll(cpt_dir);
}
diff --git a/src/sim/serialize.hh b/src/sim/serialize.hh
index a80dc99e4..880fb0785 100644
--- a/src/sim/serialize.hh
+++ b/src/sim/serialize.hh
@@ -126,8 +126,8 @@ class Serializable
static int ckptCount;
static int ckptMaxCount;
static int ckptPrevCount;
- static void serializeAll();
- static void unserializeAll();
+ static void serializeAll(const std::string &cpt_dir);
+ static void unserializeAll(const std::string &cpt_dir);
static void unserializeGlobals(Checkpoint *cp);
};
@@ -206,7 +206,7 @@ SerializableClass the##OBJ_CLASS##Class(CLASS_NAME, \
OBJ_CLASS::createForUnserialize);
void
-setCheckpointName(const std::string &name);
+setCheckpointDir(const std::string &name);
class Checkpoint
{