changeset 00dca8a9b560 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=00dca8a9b560
description:
kvm: Add a stat counting number of instructions executed
This changeset adds a 'numInsts' stat to the KVM-based CPU. It also
cleans up the variable names in kvmRun to make the distinction between
host cycles and estimated simulated cycles clearer. As a bonus
feature, it also fixes a warning (unreferenced variable) when
compiling in fast mode.
diffstat:
src/cpu/kvm/base.cc | 20 +++++++++++++-------
src/cpu/kvm/base.hh | 1 +
2 files changed, 14 insertions(+), 7 deletions(-)
diffs (58 lines):
diff -r 2c52e4537e6c -r 00dca8a9b560 src/cpu/kvm/base.cc
--- a/src/cpu/kvm/base.cc Thu May 02 12:02:19 2013 +0200
+++ b/src/cpu/kvm/base.cc Thu May 02 12:03:43 2013 +0200
@@ -175,6 +175,11 @@
BaseCPU::regStats();
+ numInsts
+ .name(name() + ".committedInsts")
+ .desc("Number of instructions committed")
+ ;
+
numVMExits
.name(name() + ".numVMExits")
.desc("total number of KVM exits")
@@ -485,8 +490,10 @@
hwCycles.stop();
- uint64_t cyclesExecuted(hwCycles.read() - baseCycles);
- Tick ticksExecuted(runTimer->ticksFromHostCycles(cyclesExecuted));
+ const uint64_t hostCyclesExecuted(hwCycles.read() - baseCycles);
+ const uint64_t simCyclesExecuted(hostCyclesExecuted * hostFactor);
+ const uint64_t instsExecuted(hwInstructions.read() - baseInstrs);
+ const Tick
ticksExecuted(runTimer->ticksFromHostCycles(hostCyclesExecuted));
if (ticksExecuted < ticks &&
timerOverflowed &&
@@ -496,14 +503,13 @@
ticks, ticksExecuted);
}
- numCycles += cyclesExecuted * hostFactor;
+ /* Update statistics */
+ numCycles += simCyclesExecuted;;
++numVMExits;
+ numInsts += instsExecuted;
DPRINTF(KvmRun, "KVM: Executed %i instructions in %i cycles (%i ticks, sim
cycles: %i).\n",
- hwInstructions.read() - baseInstrs,
- cyclesExecuted,
- ticksExecuted,
- cyclesExecuted * hostFactor);
+ instsExecuted, hostCyclesExecuted, ticksExecuted,
simCyclesExecuted);
return ticksExecuted + flushCoalescedMMIO();
}
diff -r 2c52e4537e6c -r 00dca8a9b560 src/cpu/kvm/base.hh
--- a/src/cpu/kvm/base.hh Thu May 02 12:02:19 2013 +0200
+++ b/src/cpu/kvm/base.hh Thu May 02 12:03:43 2013 +0200
@@ -510,6 +510,7 @@
public:
/* @{ */
+ Stats::Scalar numInsts;
Stats::Scalar numVMExits;
Stats::Scalar numMMIO;
Stats::Scalar numCoalescedMMIO;
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev