-
Notifications
You must be signed in to change notification settings - Fork 2
index 5
Shumin Lee edited this page Mar 31, 2017
·
1 revision
$ vi gem5/src/cpu/base.hh
....
550 static int numSimulatedCPUs() { return cpuList.size(); }
551 static Counter numSimulatedInsts()
552 {
553 Counter total = 0;
554
555 int size = cpuList.size();
556 for (int i = 0; i < size; ++i)
557 total += cpuList[i]->totalInsts();
558
559 return total;
560 }
561
562 static Counter numSimulatedOps()
563 {
564 Counter total = 0;
565
566 int size = cpuList.size();
567 for (int i = 0; i < size; ++i)
568 total += cpuList[i]->totalOps();
569
570 return total;
571 }
....
$ vi gem5/src/cpu/or3/cpu.cc
....
690 template <class Impl>
691 Counter
692 FullO3CPU<Impl>::totalOps() const
693 {
694 Counter total(0);
695
696 ThreadID size = thread.size();
697 for (ThreadID i = 0; i < size; i++)
698 total += thread[i]->numOp;
699
700 return total;
701 }
....
$ vi gem5/src/cpu/o3/cpu.cc
....
1432 FullO3CPU<Impl>::instDone(ThreadID tid, DynInstPtr &inst)
1433 {
1434 // Keep an instruction count.
1435 if (!inst->isMicroop() || inst->isLastMicroop()) {
1436 thread[tid]->numInst++;
1437 thread[tid]->numInsts++;
1438 committedInsts[tid]++;
1439 system->totalNumInsts++;
1440
1441 // Check for instruction-count-based events.
1442 comInstEventQueue[tid]->serviceEvents(thread[tid]->numInst);
1443 system->instEventQueue.serviceEvents(system->totalNumInsts);
1444 }
1445 thread[tid]->numOp++;
1446 thread[tid]->numOps++;
1447 committedOps[tid]++;
1448
1449 probeInstCommit(inst->staticInst);
1450 }
....
$ vi gem5/src/cpu/o3/cpu.hh
....
660 /** Pointers to all of the threads in the CPU. */
661 std::vector<Thread *> thread;
....
$ vi gem5/src/cpu/o3/cpu.hh
....
107 typedef O3ThreadState<Impl> Thread;
....
$ vi gem5/src/cpu/o3/thread_state.hh
....
48 #include "cpu/thread_context.hh"
49 #include "cpu/thread_state.hh"
50 #include "sim/full_system.hh"
....
67 template <class Impl>
68 struct O3ThreadState : public ThreadState {
....
$ vi gem5/src/cpu/thread_state.hh
....
128 public:
129
130 /** Number of instructions committed. */
131 Counter numInst;
132 /** Stat for number instructions committed. */
133 Stats::Scalar numInsts;
134 /** Number of ops (including micro ops) committed. */
135 Counter numOp;
136 /** Stat for number ops (including micro ops) committed. */
137 Stats::Scalar numOps;
....
$ vi gem5/src/cpu/o3/commit_impl.hh
....
1369 // To match the old model, don't count nops and instruction
1370 // prefetches towards the total commit count.
1371 if (!inst->isNop() && !inst->isInstPrefetch()) {
1372 cpu->instDone(tid, inst);
1373 }
....