fix the checkpoint bug

--HG--
extra : convert_revision : 1ccae3282737d70b14ff86c8647e2e662a42c3bc
This commit is contained in:
Ali Saidi 2006-05-12 17:47:23 -04:00
parent d1e6f48203
commit 7929b9ee19
3 changed files with 13 additions and 6 deletions

View file

@ -1448,6 +1448,8 @@ Base::unserialize(Checkpoint *cp, const std::string &section)
void void
Device::serialize(ostream &os) Device::serialize(ostream &os)
{ {
int count;
// Serialize the PciDev base class // Serialize the PciDev base class
Base::serialize(os); Base::serialize(os);

View file

@ -51,8 +51,9 @@
using namespace std; using namespace std;
int Serializable::maxCount = 0; int Serializable::ckptMaxCount = 0;
int Serializable::count = 0; int Serializable::ckptCount = 0;
int Serializable::ckptPrevCount = -1;
void void
Serializable::nameOut(ostream &os) Serializable::nameOut(ostream &os)
@ -241,8 +242,11 @@ Serializable::serializeAll()
globals.serialize(outstream); globals.serialize(outstream);
SimObject::serializeAll(outstream); SimObject::serializeAll(outstream);
if (maxCount && ++count >= maxCount) assert(Serializable::ckptPrevCount + 1 == Serializable::ckptCount);
Serializable::ckptPrevCount++;
if (ckptMaxCount && ++ckptCount >= ckptMaxCount)
SimExit(curTick + 1, "Maximum number of checkpoints dropped"); SimExit(curTick + 1, "Maximum number of checkpoints dropped");
} }
@ -352,7 +356,7 @@ SerializeParamContext::checkParams()
if (serialize_cycle > 0) if (serialize_cycle > 0)
Checkpoint::setup(serialize_cycle, serialize_period); Checkpoint::setup(serialize_cycle, serialize_period);
Serializable::maxCount = serialize_count; Serializable::ckptMaxCount = serialize_count;
} }
void void

View file

@ -119,8 +119,9 @@ class Serializable
static Serializable *create(Checkpoint *cp, static Serializable *create(Checkpoint *cp,
const std::string &section); const std::string &section);
static int count; static int ckptCount;
static int maxCount; static int ckptMaxCount;
static int ckptPrevCount;
static void serializeAll(); static void serializeAll();
static void unserializeGlobals(Checkpoint *cp); static void unserializeGlobals(Checkpoint *cp);
}; };