summaryrefslogtreecommitdiff
path: root/src/cpu/inorder
diff options
context:
space:
mode:
authorKorey Sewell <ksewell@umich.edu>2010-01-31 18:29:49 -0500
committerKorey Sewell <ksewell@umich.edu>2010-01-31 18:29:49 -0500
commit002f1b8b7e1d5292828e5157ff971965265140bc (patch)
treedfa25519c47b620cc18d6c142beca2166710a278 /src/cpu/inorder
parent82c5a754e684af6522f339ab30d2c661ee9c220c (diff)
downloadgem5-002f1b8b7e1d5292828e5157ff971965265140bc.tar.xz
inorder: add execution unit stats
Diffstat (limited to 'src/cpu/inorder')
-rw-r--r--src/cpu/inorder/resources/execution_unit.cc17
-rw-r--r--src/cpu/inorder/resources/execution_unit.hh5
2 files changed, 22 insertions, 0 deletions
diff --git a/src/cpu/inorder/resources/execution_unit.cc b/src/cpu/inorder/resources/execution_unit.cc
index 6c44e2456..429291231 100644
--- a/src/cpu/inorder/resources/execution_unit.cc
+++ b/src/cpu/inorder/resources/execution_unit.cc
@@ -54,6 +54,17 @@ ExecutionUnit::regStats()
.name(name() + ".predictedNotTakenIncorrect")
.desc("Number of Branches Incorrectly Predicted As Not Taken).");
+ lastExecuteCycle = curTick;
+
+ cyclesExecuted
+ .name(name() + ".cyclesExecuted")
+ .desc("Number of Cycles Execution Unit was used.");
+
+ utilization
+ .name(name() + ".utilization")
+ .desc("Utilization of Execution Unit (cycles / totalCycles).");
+ utilization = cyclesExecuted / cpu->numCycles;
+
Resource::regStats();
}
@@ -75,6 +86,12 @@ ExecutionUnit::execute(int slot_num)
{
case ExecuteInst:
{
+ if (curTick != lastExecuteCycle) {
+ lastExecuteCycle = curTick;
+ cyclesExecuted++;
+ }
+
+
if (inst->isMemRef()) {
panic("%s not configured to handle memory ops.\n", resName);
} else if (inst->isControl()) {
diff --git a/src/cpu/inorder/resources/execution_unit.hh b/src/cpu/inorder/resources/execution_unit.hh
index 46691bbf2..37651e873 100644
--- a/src/cpu/inorder/resources/execution_unit.hh
+++ b/src/cpu/inorder/resources/execution_unit.hh
@@ -71,6 +71,11 @@ class ExecutionUnit : public Resource {
/////////////////////////////////////////////////////////////////
Stats::Scalar predictedTakenIncorrect;
Stats::Scalar predictedNotTakenIncorrect;
+
+ Stats::Scalar cyclesExecuted;
+ Tick lastExecuteCycle;
+
+ Stats::Formula utilization;
};