changeset a152d7f114b8 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=a152d7f114b8
description:
kvm: Maintain a local instruction counter and update totalNumInsts
Update the system's totalNumInst counter when exiting from KVM and
maintain an internal absolute instruction count instead of relying on
the one from perf.
diffstat:
src/cpu/kvm/base.cc | 9 ++++++---
src/cpu/kvm/base.hh | 3 +++
2 files changed, 9 insertions(+), 3 deletions(-)
diffs (52 lines):
diff -r e039a48eeb99 -r a152d7f114b8 src/cpu/kvm/base.cc
--- a/src/cpu/kvm/base.cc Tue Jun 11 09:24:38 2013 +0200
+++ b/src/cpu/kvm/base.cc Tue Jun 11 09:24:40 2013 +0200
@@ -80,7 +80,8 @@
pageSize(sysconf(_SC_PAGE_SIZE)),
tickEvent(*this),
perfControlledByTimer(params->usePerfOverflow),
- hostFactor(params->hostFactor)
+ hostFactor(params->hostFactor),
+ ctrInsts(0)
{
if (pageSize == -1)
panic("KVM: Failed to determine host page size (%i)\n",
@@ -416,14 +417,14 @@
Counter
BaseKvmCPU::totalInsts() const
{
- return hwInstructions.read();
+ return ctrInsts;
}
Counter
BaseKvmCPU::totalOps() const
{
hack_once("Pretending totalOps is equivalent to totalInsts()\n");
- return hwInstructions.read();
+ return ctrInsts;
}
void
@@ -522,6 +523,8 @@
numCycles += simCyclesExecuted;;
++numVMExits;
numInsts += instsExecuted;
+ ctrInsts += instsExecuted;
+ system->totalNumInsts += instsExecuted;
DPRINTF(KvmRun, "KVM: Executed %i instructions in %i cycles (%i ticks, sim
cycles: %i).\n",
instsExecuted, hostCyclesExecuted, ticksExecuted,
simCyclesExecuted);
diff -r e039a48eeb99 -r a152d7f114b8 src/cpu/kvm/base.hh
--- a/src/cpu/kvm/base.hh Tue Jun 11 09:24:38 2013 +0200
+++ b/src/cpu/kvm/base.hh Tue Jun 11 09:24:40 2013 +0200
@@ -561,6 +561,9 @@
Stats::Scalar numInterrupts;
Stats::Scalar numHypercalls;
/* @} */
+
+ /** Number of instructions executed by the CPU */
+ Counter ctrInsts;
};
#endif
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev