cpu: fix simInsts and simOps not resetting (#1615)
This PR fixes the bug where simInsts and simOps don't reset when m5.stats.reset() is called. The stats hostInstRate and hostOpRate are affected by this change as well, as they depend on simInsts and simOps respectively. This is related to issue 1443 linked [here](https://github.com/gem5/gem5/issues/1443).
This commit is contained in:
committed by
GitHub
parent
3443788013
commit
feeb3b2d67
@@ -859,13 +859,13 @@ BaseCPU::GlobalStats::GlobalStats(statistics::Group *parent)
|
||||
"Simulator op (including micro ops) rate (op/s)")
|
||||
{
|
||||
simInsts
|
||||
.functor(BaseCPU::numSimulatedInsts)
|
||||
.functor(BaseCPU::GlobalStats::numSimulatedInsts)
|
||||
.precision(0)
|
||||
.prereq(simInsts)
|
||||
;
|
||||
|
||||
simOps
|
||||
.functor(BaseCPU::numSimulatedOps)
|
||||
.functor(BaseCPU::GlobalStats::numSimulatedOps)
|
||||
.precision(0)
|
||||
.prereq(simOps)
|
||||
;
|
||||
|
||||
@@ -156,6 +156,30 @@ class BaseCPU : public ClockedObject
|
||||
|
||||
statistics::Formula hostInstRate;
|
||||
statistics::Formula hostOpRate;
|
||||
|
||||
Counter previousInsts = 0;
|
||||
Counter previousOps = 0;
|
||||
|
||||
static Counter
|
||||
numSimulatedInsts()
|
||||
{
|
||||
return totalNumSimulatedInsts() - (globalStats->previousInsts);
|
||||
}
|
||||
|
||||
static Counter
|
||||
numSimulatedOps()
|
||||
{
|
||||
return totalNumSimulatedOps() - (globalStats->previousOps);
|
||||
}
|
||||
|
||||
void
|
||||
resetStats() override
|
||||
{
|
||||
previousInsts = totalNumSimulatedInsts();
|
||||
previousOps = totalNumSimulatedOps();
|
||||
|
||||
statistics::Group::resetStats();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -609,7 +633,7 @@ class BaseCPU : public ClockedObject
|
||||
|
||||
static int numSimulatedCPUs() { return cpuList.size(); }
|
||||
static Counter
|
||||
numSimulatedInsts()
|
||||
totalNumSimulatedInsts()
|
||||
{
|
||||
Counter total = 0;
|
||||
|
||||
@@ -621,7 +645,7 @@ class BaseCPU : public ClockedObject
|
||||
}
|
||||
|
||||
static Counter
|
||||
numSimulatedOps()
|
||||
totalNumSimulatedOps()
|
||||
{
|
||||
Counter total = 0;
|
||||
|
||||
|
||||
@@ -122,7 +122,7 @@ ElasticTrace::regEtraceListeners()
|
||||
{
|
||||
assert(!allProbesReg);
|
||||
inform("@%llu: No. of instructions committed = %llu, registering elastic"
|
||||
" probe listeners", curTick(), cpu->numSimulatedInsts());
|
||||
" probe listeners", curTick(), cpu->totalNumSimulatedInsts());
|
||||
// Create new listeners: provide method to be called upon a notify() for
|
||||
// each probe point.
|
||||
listeners.push_back(new ProbeListenerArg<ElasticTrace, RequestPtr>(this,
|
||||
|
||||
Reference in New Issue
Block a user