summaryrefslogtreecommitdiff
path: root/src/cpu/trace/trace_cpu.hh
diff options
context:
space:
mode:
authorRadhika Jagtap <radhika.jagtap@arm.com>2016-09-15 18:01:16 +0100
committerRadhika Jagtap <radhika.jagtap@arm.com>2016-09-15 18:01:16 +0100
commitd067327fc0c1a67ad2d456840e83db7b593b94a0 (patch)
tree693f455704b384e6215fde31ef15195466751936 /src/cpu/trace/trace_cpu.hh
parentd7724d5f542b3ffcb1de05bc2960c820c7b96c85 (diff)
downloadgem5-d067327fc0c1a67ad2d456840e83db7b593b94a0.tar.xz
cpu: Adjust for trace offset and fix stats
This change subtracts the time offset present in the trace from all the event times when nodes and request are sent so that the replay starts immediately when the simulation starts. This makes the stats accurate when the time offset in traces is large, for example when traces are generated in the middle of a workload execution. It also solves the problem of unnecessary DRAM refresh events that would keep occuring during the large time offset before even a single request is replayed into the system. Change-Id: Ie0898842615def867ffd5c219948386d952af7f7 Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Diffstat (limited to 'src/cpu/trace/trace_cpu.hh')
-rw-r--r--src/cpu/trace/trace_cpu.hh38
1 files changed, 23 insertions, 15 deletions
diff --git a/src/cpu/trace/trace_cpu.hh b/src/cpu/trace/trace_cpu.hh
index 2c7168d51..7da59de97 100644
--- a/src/cpu/trace/trace_cpu.hh
+++ b/src/cpu/trace/trace_cpu.hh
@@ -136,10 +136,9 @@
* Strictly-ordered requests are skipped and the dependencies on such requests
* are handled by simply marking them complete immediately.
*
- * The simulated seconds can be calculated as the difference between the
- * final_tick stat and the tickOffset stat. A CountedExitEvent that contains a
- * static int belonging to the Trace CPU class as a down counter is used to
- * implement multi Trace CPU simulation exit.
+ * A CountedExitEvent that contains a static int belonging to the Trace CPU
+ * class as a down counter is used to implement multi Trace CPU simulation
+ * exit.
*/
class TraceCPU : public BaseCPU
@@ -171,9 +170,15 @@ class TraceCPU : public BaseCPU
*/
Counter totalOps() const
{
- return dcacheGen.getMicroOpCount();
+ return numOps.value();
}
+ /*
+ * Set the no. of ops when elastic data generator completes executing a
+ * node.
+ */
+ void updateNumOps(uint64_t rob_num) { numOps = rob_num; }
+
/* Pure virtual function in BaseCPU. Do nothing. */
void wakeup(ThreadID tid = 0)
{
@@ -876,6 +881,14 @@ class TraceCPU : public BaseCPU
*/
Tick init();
+ /**
+ * Adjust traceOffset based on what TraceCPU init() determines on
+ * comparing the offsets in the fetch request and elastic traces.
+ *
+ * @param trace_offset trace offset set by comparing both traces
+ */
+ void adjustInitTraceOffset(Tick& offset);
+
/** Returns name of the ElasticDataGen instance. */
const std::string& name() const { return genName; }
@@ -1081,10 +1094,12 @@ class TraceCPU : public BaseCPU
bool oneTraceComplete;
/**
- * This is stores the tick of the first instruction fetch request
- * which is later used for dumping the tickOffset stat.
+ * This stores the time offset in the trace, which is taken away from
+ * the ready times of requests. This is specially useful because the time
+ * offset can be very large if the traces are generated from the middle of
+ * a program.
*/
- Tick firstFetchTick;
+ Tick traceOffset;
/**
* Number of Trace CPUs in the system used as a shared variable and passed
@@ -1109,13 +1124,6 @@ class TraceCPU : public BaseCPU
/** Stat for the CPI. This is really cycles per micro-op and not inst. */
Stats::Formula cpi;
- /**
- * The first execution tick is dumped as a stat so that the simulated
- * seconds for a trace replay can be calculated as a difference between the
- * final_tick stat and the tickOffset stat
- */
- Stats::Scalar tickOffset;
-
public:
/** Used to get a reference to the icache port. */