summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cpu/base.cc29
-rw-r--r--src/cpu/base.hh10
-rw-r--r--src/cpu/inorder/cpu.hh11
3 files changed, 36 insertions, 14 deletions
diff --git a/src/cpu/base.cc b/src/cpu/base.cc
index 0ef206d90..78ff4f998 100644
--- a/src/cpu/base.cc
+++ b/src/cpu/base.cc
@@ -61,11 +61,11 @@ vector<BaseCPU *> BaseCPU::cpuList;
int maxThreadsPerCPU = 1;
CPUProgressEvent::CPUProgressEvent(BaseCPU *_cpu, Tick ival)
- : Event(Event::Progress_Event_Pri), interval(ival), lastNumInst(0),
- cpu(_cpu)
+ : Event(Event::Progress_Event_Pri), _interval(ival), lastNumInst(0),
+ cpu(_cpu), _repeatEvent(true)
{
- if (interval)
- cpu->schedule(this, curTick + interval);
+ if (_interval)
+ cpu->schedule(this, curTick + _interval);
}
void
@@ -73,17 +73,21 @@ CPUProgressEvent::process()
{
Counter temp = cpu->totalInstructions();
#ifndef NDEBUG
- double ipc = double(temp - lastNumInst) / (interval / cpu->ticks(1));
+ double ipc = double(temp - lastNumInst) / (_interval / cpu->ticks(1));
- DPRINTFN("%s progress event, instructions committed: %lli, IPC: %0.8d\n",
- cpu->name(), temp - lastNumInst, ipc);
+ DPRINTFN("%s progress event, total committed:%i, progress insts committed: "
+ "%lli, IPC: %0.8d\n", cpu->name(), temp, temp - lastNumInst,
+ ipc);
ipc = 0.0;
#else
- cprintf("%lli: %s progress event, instructions committed: %lli\n",
- curTick, cpu->name(), temp - lastNumInst);
+ cprintf("%lli: %s progress event, total committed:%i, progress insts "
+ "committed: %lli\n", curTick, cpu->name(), temp,
+ temp - lastNumInst);
#endif
lastNumInst = temp;
- cpu->schedule(this, curTick + interval);
+
+ if (_repeatEvent)
+ cpu->schedule(this, curTick + _interval);
}
const char *
@@ -230,8 +234,9 @@ BaseCPU::startup()
if (params()->progress_interval) {
Tick num_ticks = ticks(params()->progress_interval);
- Event *event = new CPUProgressEvent(this, num_ticks);
- schedule(event, curTick + num_ticks);
+
+ Event *event;
+ event = new CPUProgressEvent(this, num_ticks);
}
}
diff --git a/src/cpu/base.hh b/src/cpu/base.hh
index 8af3295eb..e63960cc1 100644
--- a/src/cpu/base.hh
+++ b/src/cpu/base.hh
@@ -61,15 +61,21 @@ namespace TheISA
class CPUProgressEvent : public Event
{
protected:
- Tick interval;
+ Tick _interval;
Counter lastNumInst;
BaseCPU *cpu;
+ bool _repeatEvent;
public:
- CPUProgressEvent(BaseCPU *_cpu, Tick ival);
+ CPUProgressEvent(BaseCPU *_cpu, Tick ival = 0);
void process();
+ void interval(Tick ival) { _interval = ival; }
+ Tick interval() { return _interval; }
+
+ void repeatEvent(bool repeat) { _repeatEvent = repeat; }
+
virtual const char *description() const;
};
diff --git a/src/cpu/inorder/cpu.hh b/src/cpu/inorder/cpu.hh
index 0545f4bf8..744dd5cf9 100644
--- a/src/cpu/inorder/cpu.hh
+++ b/src/cpu/inorder/cpu.hh
@@ -589,6 +589,17 @@ class InOrderCPU : public BaseCPU
return thread[tid]->getTC();
}
+ /** Count the Total Instructions Committed in the CPU. */
+ virtual Counter totalInstructions() const
+ {
+ Counter total(0);
+
+ for (int i=0; i < thread.size(); i++)
+ total += thread[i]->numInst;
+
+ return total;
+ }
+
/** The global sequence number counter. */
InstSeqNum globalSeqNum[ThePipeline::MaxThreads];