diff options
author | Anthony Gutierrez <atgutier@umich.edu> | 2012-02-12 16:07:39 -0600 |
---|---|---|
committer | Anthony Gutierrez <atgutier@umich.edu> | 2012-02-12 16:07:39 -0600 |
commit | 542d0ceebca1d24bfb433ce9fe916b0586f8d029 (patch) | |
tree | 45afbefa2ec6a79de564d2c4505667a4d974e1f5 /src/cpu/o3 | |
parent | 230540e655efd09ad057e7fde2ac257f355c06d1 (diff) | |
download | gem5-542d0ceebca1d24bfb433ce9fe916b0586f8d029.tar.xz |
cpu: add separate stats for insts/ops both globally and per cpu model
Diffstat (limited to 'src/cpu/o3')
-rw-r--r-- | src/cpu/o3/commit.hh | 6 | ||||
-rw-r--r-- | src/cpu/o3/commit_impl.hh | 33 | ||||
-rw-r--r-- | src/cpu/o3/cpu.cc | 36 | ||||
-rw-r--r-- | src/cpu/o3/cpu.hh | 9 |
4 files changed, 67 insertions, 17 deletions
diff --git a/src/cpu/o3/commit.hh b/src/cpu/o3/commit.hh index 094518655..b5539c702 100644 --- a/src/cpu/o3/commit.hh +++ b/src/cpu/o3/commit.hh @@ -449,6 +449,8 @@ class DefaultCommit /** Stat for the total number of committed instructions. */ Stats::Scalar commitCommittedInsts; + /** Stat for the total number of committed ops. */ + Stats::Scalar commitCommittedOps; /** Stat for the total number of squashed instructions discarded by commit. */ Stats::Scalar commitSquashedInsts; @@ -466,7 +468,9 @@ class DefaultCommit Stats::Distribution numCommittedDist; /** Total number of instructions committed. */ - Stats::Vector statComInst; + Stats::Vector instsCommitted; + /** Total number of ops (including micro ops) committed. */ + Stats::Vector opsCommitted; /** Total number of software prefetches committed. */ Stats::Vector statComSwp; /** Stat for the total number of committed memory references. */ diff --git a/src/cpu/o3/commit_impl.hh b/src/cpu/o3/commit_impl.hh index 446c8e6f3..7ca42ae5b 100644 --- a/src/cpu/o3/commit_impl.hh +++ b/src/cpu/o3/commit_impl.hh @@ -169,6 +169,10 @@ DefaultCommit<Impl>::regStats() .name(name() + ".commitCommittedInsts") .desc("The number of committed instructions") .prereq(commitCommittedInsts); + commitCommittedOps + .name(name() + ".commitCommittedOps") + .desc("The number of committed instructions") + .prereq(commitCommittedInsts); commitSquashedInsts .name(name() + ".commitSquashedInsts") .desc("The number of squashed insts skipped by commit") @@ -193,13 +197,20 @@ DefaultCommit<Impl>::regStats() .flags(Stats::pdf) ; - statComInst + instsCommitted .init(cpu->numThreads) - .name(name() + ".count") + .name(name() + ".committedInsts") .desc("Number of instructions committed") .flags(total) ; + opsCommitted + .init(cpu->numThreads) + .name(name() + ".committedOps") + .desc("Number of ops (including micro ops) committed") + .flags(total) + ; + statComSwp .init(cpu->numThreads) .name(name() + ".swp_count") @@ -988,12 +999,14 @@ DefaultCommit<Impl>::commitInsts() // Set the doneSeqNum to the youngest committed instruction. toIEW->commitInfo[tid].doneSeqNum = head_inst->seqNum; - ++commitCommittedInsts; + if (!head_inst->isMicroop() || head_inst->isLastMicroop()) + ++commitCommittedInsts; + ++commitCommittedOps; // To match the old model, don't count nops and instruction // prefetches towards the total commit count. if (!head_inst->isNop() && !head_inst->isInstPrefetch()) { - cpu->instDone(tid); + cpu->instDone(tid, head_inst); } if (tid == 0) { @@ -1175,7 +1188,7 @@ DefaultCommit<Impl>::commitHead(DynInstPtr &head_inst, unsigned inst_num) if (head_inst->traceData) { if (DTRACE(ExecFaulting)) { head_inst->traceData->setFetchSeq(head_inst->seqNum); - head_inst->traceData->setCPSeq(thread[tid]->numInst); + head_inst->traceData->setCPSeq(thread[tid]->numOp); head_inst->traceData->dump(); } delete head_inst->traceData; @@ -1209,7 +1222,7 @@ DefaultCommit<Impl>::commitHead(DynInstPtr &head_inst, unsigned inst_num) head_inst->seqNum, head_inst->pcState()); if (head_inst->traceData) { head_inst->traceData->setFetchSeq(head_inst->seqNum); - head_inst->traceData->setCPSeq(thread[tid]->numInst); + head_inst->traceData->setCPSeq(thread[tid]->numOp); head_inst->traceData->dump(); delete head_inst->traceData; head_inst->traceData = NULL; @@ -1360,10 +1373,14 @@ DefaultCommit<Impl>::updateComInstStats(DynInstPtr &inst) if (inst->isDataPrefetch()) { statComSwp[tid]++; } else { - statComInst[tid]++; + if (!inst->isMicroop() || inst->isLastMicroop()) + instsCommitted[tid]++; + opsCommitted[tid]++; } #else - statComInst[tid]++; + if (!inst->isMicroop() || inst->isLastMicroop()) + instsCommitted[tid]++; + opsCommitted[tid]++; #endif // diff --git a/src/cpu/o3/cpu.cc b/src/cpu/o3/cpu.cc index d16270943..82f17adc9 100644 --- a/src/cpu/o3/cpu.cc +++ b/src/cpu/o3/cpu.cc @@ -506,6 +506,11 @@ FullO3CPU<Impl>::regStats() .name(name() + ".committedInsts") .desc("Number of Instructions Simulated"); + committedOps + .init(numThreads) + .name(name() + ".committedOps") + .desc("Number of Ops (including micro ops) Simulated"); + totalCommittedInsts .name(name() + ".committedInsts_total") .desc("Number of Instructions Simulated"); @@ -718,7 +723,7 @@ FullO3CPU<Impl>::deactivateThread(ThreadID tid) template <class Impl> Counter -FullO3CPU<Impl>::totalInstructions() const +FullO3CPU<Impl>::totalInsts() const { Counter total(0); @@ -730,6 +735,19 @@ FullO3CPU<Impl>::totalInstructions() const } template <class Impl> +Counter +FullO3CPU<Impl>::totalOps() const +{ + Counter total(0); + + ThreadID size = thread.size(); + for (ThreadID i = 0; i < size; i++) + total += thread[i]->numOp; + + return total; +} + +template <class Impl> void FullO3CPU<Impl>::activateContext(ThreadID tid, int delay) { @@ -1458,13 +1476,19 @@ FullO3CPU<Impl>::addInst(DynInstPtr &inst) template <class Impl> void -FullO3CPU<Impl>::instDone(ThreadID tid) +FullO3CPU<Impl>::instDone(ThreadID tid, DynInstPtr &inst) { // Keep an instruction count. - thread[tid]->numInst++; - thread[tid]->numInsts++; - committedInsts[tid]++; - totalCommittedInsts++; + if (!inst->isMicroop() || inst->isLastMicroop()) { + thread[tid]->numInst++; + thread[tid]->numInsts++; + committedInsts[tid]++; + totalCommittedInsts++; + } + thread[tid]->numOp++; + thread[tid]->numOps++; + committedOps[tid]++; + system->totalNumInsts++; // Check for instruction-count-based events. comInstEventQueue[tid]->serviceEvents(thread[tid]->numInst); diff --git a/src/cpu/o3/cpu.hh b/src/cpu/o3/cpu.hh index 94c0a873b..1c713097a 100644 --- a/src/cpu/o3/cpu.hh +++ b/src/cpu/o3/cpu.hh @@ -389,7 +389,10 @@ class FullO3CPU : public BaseO3CPU void removeThread(ThreadID tid); /** Count the Total Instructions Committed in the CPU. */ - virtual Counter totalInstructions() const; + virtual Counter totalInsts() const; + + /** Count the Total Ops (including micro ops) committed in the CPU. */ + virtual Counter totalOps() const; /** Add Thread to Active Threads List. */ void activateContext(ThreadID tid, int delay); @@ -547,7 +550,7 @@ class FullO3CPU : public BaseO3CPU ListIt addInst(DynInstPtr &inst); /** Function to tell the CPU that an instruction has completed. */ - void instDone(ThreadID tid); + void instDone(ThreadID tid, DynInstPtr &inst); /** Remove an instruction from the front end of the list. There's * no restriction on location of the instruction. @@ -797,6 +800,8 @@ class FullO3CPU : public BaseO3CPU Stats::Scalar quiesceCycles; /** Stat for the number of committed instructions per thread. */ Stats::Vector committedInsts; + /** Stat for the number of committed ops (including micro ops) per thread. */ + Stats::Vector committedOps; /** Stat for the total number of committed instructions. */ Stats::Scalar totalCommittedInsts; /** Stat for the CPI per thread. */ |