O3CPU: Make the instcount debugging stuff per-cpu.

This is to prevent the assertion from firing if you have a large multicore.
Also make sure that it's not compiled in when NDEBUG is defined
This commit is contained in:
Clint Smullen 2008-11-10 11:51:18 -08:00
parent 9c49bc7b00
commit 1adfe5c7f3
8 changed files with 30 additions and 19 deletions

View file

@ -258,9 +258,6 @@ class BaseDynInst : public FastAlloc, public RefCounted
public: public:
/** Count of total number of dynamic instructions. */
static int instcount;
#ifdef DEBUG #ifdef DEBUG
void dumpSNList(); void dumpSNList();
#endif #endif

View file

@ -168,18 +168,21 @@ BaseDynInst<Impl>::initVars()
// Initialize the fault to be NoFault. // Initialize the fault to be NoFault.
fault = NoFault; fault = NoFault;
++instcount; #ifndef NDEBUG
++cpu->instcount;
if (instcount > 1500) { if (cpu->instcount > 1500) {
#ifdef DEBUG #ifdef DEBUG
cpu->dumpInsts(); cpu->dumpInsts();
dumpSNList(); dumpSNList();
#endif #endif
assert(instcount <= 1500); assert(cpu->instcount <= 1500);
} }
DPRINTF(DynInst, "DynInst: [sn:%lli] Instruction created. Instcount=%i\n", DPRINTF(DynInst,
seqNum, instcount); "DynInst: [sn:%lli] Instruction created. Instcount for %s = %i\n",
seqNum, cpu->name(), cpu->instcount);
#endif
#ifdef DEBUG #ifdef DEBUG
cpu->snList.insert(seqNum); cpu->snList.insert(seqNum);
@ -199,10 +202,13 @@ BaseDynInst<Impl>::~BaseDynInst()
fault = NoFault; fault = NoFault;
--instcount; #ifndef NDEBUG
--cpu->instcount;
DPRINTF(DynInst, "DynInst: [sn:%lli] Instruction destroyed. Instcount=%i\n", DPRINTF(DynInst,
seqNum, instcount); "DynInst: [sn:%lli] Instruction destroyed. Instcount for %s = %i\n",
seqNum, cpu->name(), cpu->instcount);
#endif
#ifdef DEBUG #ifdef DEBUG
cpu->snList.erase(seqNum); cpu->snList.erase(seqNum);
#endif #endif

View file

@ -34,7 +34,3 @@
// Explicit instantiation // Explicit instantiation
template class BaseDynInst<O3CPUImpl>; template class BaseDynInst<O3CPUImpl>;
template <>
int
BaseDynInst<O3CPUImpl>::instcount = 0;

View file

@ -159,6 +159,9 @@ FullO3CPU<Impl>::FullO3CPU(DerivO3CPUParams *params)
itb(params->itb), itb(params->itb),
dtb(params->dtb), dtb(params->dtb),
tickEvent(this), tickEvent(this),
#ifndef NDEBUG
instcount(0),
#endif
removeInstsThisCycle(false), removeInstsThisCycle(false),
fetch(this, params), fetch(this, params),
decode(this, params), decode(this, params),

View file

@ -576,6 +576,11 @@ class FullO3CPU : public BaseO3CPU
void dumpInsts(); void dumpInsts();
public: public:
#ifndef NDEBUG
/** Count of total number of dynamic instructions in flight. */
int instcount;
#endif
/** List of all the instructions in flight. */ /** List of all the instructions in flight. */
std::list<DynInstPtr> instList; std::list<DynInstPtr> instList;

View file

@ -33,7 +33,3 @@
// Explicit instantiation // Explicit instantiation
template class BaseDynInst<OzoneImpl>; template class BaseDynInst<OzoneImpl>;
template <>
int
BaseDynInst<OzoneImpl>::instcount = 0;

View file

@ -287,6 +287,11 @@ class OzoneCPU : public BaseCPU
// main simulation loop (one cycle) // main simulation loop (one cycle)
void tick(); void tick();
#ifndef NDEBUG
/** Count of total number of dynamic instructions in flight. */
int instcount;
#endif
std::set<InstSeqNum> snList; std::set<InstSeqNum> snList;
std::set<Addr> lockAddrList; std::set<Addr> lockAddrList;
private: private:

View file

@ -94,6 +94,9 @@ OzoneCPU<Impl>::OzoneCPU(Params *p)
#else #else
: BaseCPU(p), thread(this, 0, p->workload[0], 0), : BaseCPU(p), thread(this, 0, p->workload[0], 0),
tickEvent(this, p->width), tickEvent(this, p->width),
#endif
#ifndef NDEBUG
instcount(0),
#endif #endif
comm(5, 5) comm(5, 5)
{ {