base/statistics.cc:
formatting
cpu/simple_cpu/simple_cpu.cc:
cpu/simple_cpu/simple_cpu.hh:
Make numInsts reset by adding a resetStats function
sim/sim_object.cc:
Register the reset callback in a slightly cleaner way to avoid
potential static member constructor ordering issues
--HG--
extra : convert_revision :
408073b4b0397fbf9dfd9c548a313f1c8c3fc031
void
Database::dump(ostream &stream)
{
-
#ifndef FS_MEASURE
list_t::iterator i = printStats.begin();
list_t::iterator end = printStats.end();
ccprintf(stream, "PRINTING BINNED STATS\n");
while (j != bins_end) {
(*j)->activate();
- map<const GenBin *, std::string>::const_iterator iter;
+ map<const GenBin *, std::string>::const_iterator iter;
iter = bin_names.find(*j);
if (iter == bin_names.end())
panic("a binned stat not found in names map!");
#ifdef FS_MEASURE
list_t::iterator i = printStats.begin();
- list_t::iterator end = printStats.end();
+ list_t::iterator end = printStats.end();
#else
- list_t::iterator i = binnedStats.begin();
- list_t::iterator end = binnedStats.end();
+ list_t::iterator i = binnedStats.begin();
+ list_t::iterator end = binnedStats.end();
#endif
- while (i != end) {
- Stat *stat = *i;
- if (stat->dodisplay())
- stat->display(stream);
- ++i;
- }
- ++j;
- ccprintf(stream, "---------------------------------\n");
+ while (i != end) {
+ Stat *stat = *i;
+ if (stat->dodisplay())
+ stat->display(stream);
+ ++i;
+ }
+ ++j;
+ ccprintf(stream, "---------------------------------\n");
}
#ifndef FS_MEASURE
ccprintf(stream, "**************ALL STATS************\n");
memReq->data = new uint8_t[64];
numInst = 0;
+ startNumInst = 0;
numLoad = 0;
+ startNumLoad = 0;
lastIcacheStall = 0;
lastDcacheStall = 0;
void
SimpleCPU::regStats()
{
+ using namespace Statistics;
+
BaseCPU::regStats();
numInsts
.prereq(dcacheStallCycles)
;
- numInsts = Statistics::scalar(numInst);
+ numInsts = Statistics::scalar(numInst) - Statistics::scalar(startNumInst);
simInsts += numInsts;
}
+void
+SimpleCPU::resetStats()
+{
+ startNumInst = numInst;
+}
+
void
SimpleCPU::serialize(ostream &os)
{
}
// statistics
- void regStats();
+ virtual void regStats();
+ virtual void resetStats();
// number of simulated instructions
Counter numInst;
+ Counter startNumInst;
Statistics::Formula numInsts;
// number of simulated memory references
// number of simulated loads
Counter numLoad;
+ Counter startNumLoad;
// number of idle cycles
Statistics::Average<> idleFraction;
{
}
-namespace {
- class __SimObjectResetCB : public Callback
- {
- public:
- __SimObjectResetCB() { Statistics::RegResetCallback(this); }
- virtual void process() { SimObject::resetAllStats(); }
- };
- __SimObjectResetCB __theSimObjectResetCB;
-}
-
void
SimObject::resetStats()
{
// call regStats() on all SimObjects and then regFormulas() on all
// SimObjects.
//
+struct SimObjectResetCB : public Callback
+{
+ virtual void process() { SimObject::resetAllStats(); }
+};
+
+namespace {
+ static SimObjectResetCB StatResetCB;
+}
+
void
SimObject::regAllStats()
{
cprintf("registering formulas for %s\n", (*i)->name());
#endif
(*i)->regFormulas();
- }
+ }
+
+ Statistics::RegResetCallback(&StatResetCB);
}
//