using namespace std;
+int Serializable::maxCount;
+int Serializable::count;
+
void
Serializable::nameOut(ostream &os)
{
void
Serializable::serializeAll()
{
+ if (maxCount && count++ > maxCount)
+ SimExit("Maximum number of checkpoints dropped");
+
string dir = Checkpoint::dir();
if (mkdir(dir.c_str(), 0775) == -1 && errno != EEXIST)
fatal("couldn't mkdir %s\n", dir);
"period to repeat serializations",
0);
-
+Param<int> serialize_count(&serialParams, "count",
+ "maximum number of checkpoints to drop");
SerializeParamContext::SerializeParamContext(const string §ion)
: ParamContext(section), event(NULL)
if (serialize_cycle > 0)
Checkpoint::setup(serialize_cycle, serialize_period);
+
+ Serializable::maxCount = serialize_count;
}
void
static Serializable *create(Checkpoint *cp,
const std::string §ion);
+ static int count;
+ static int maxCount;
static void serializeAll();
static void unserializeGlobals(Checkpoint *cp);
};