summaryrefslogtreecommitdiff
path: root/src/cpu/inorder
diff options
context:
space:
mode:
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;
};