changeset b279bad40aa3 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=b279bad40aa3
description:
sim: have a curTick per eventq
This patch adds a _curTick variable to an eventq. This variable is
updated
whenever an event is serviced in function serviceOne(), or all events
upto
a particular time are processed in function serviceEvents(). This change
helps when there are eventqs that do not make use of curTick for
scheduling
events.
diffstat:
src/base/vnc/vncinput.cc | 1 +
src/dev/intel_8254_timer.hh | 3 +-
src/dev/mc146818.hh | 2 +-
src/mem/comm_monitor.cc | 1 +
src/mem/packet_queue.cc | 1 +
src/mem/packet_queue.hh | 2 +-
src/mem/physical.cc | 1 +
src/mem/ruby/network/Topology.cc | 1 +
src/mem/ruby/system/System.cc | 6 +-
src/mem/simple_dram.cc | 1 +
src/python/swig/event.i | 2 +-
src/sim/clocked_object.hh | 1 +
src/sim/core.cc | 3 +-
src/sim/core.hh | 6 +-
src/sim/debug.cc | 2 +-
src/sim/eventq.cc | 7 +-
src/sim/eventq.hh | 69 +++-----------------------
src/sim/eventq_impl.hh | 100 +++++++++++++++++++++++++++++++++++++++
src/sim/root.cc | 1 +
src/sim/serialize.cc | 2 +-
src/sim/sim_events.cc | 2 +-
src/sim/sim_object.hh | 2 +-
src/sim/simulate.cc | 5 +-
23 files changed, 137 insertions(+), 84 deletions(-)
diffs (truncated from 515 to 300 lines):
diff -r 0fea324c832c -r b279bad40aa3 src/base/vnc/vncinput.cc
--- a/src/base/vnc/vncinput.cc Sat Nov 10 17:18:02 2012 -0600
+++ b/src/base/vnc/vncinput.cc Fri Nov 16 10:27:47 2012 -0600
@@ -46,6 +46,7 @@
#include "base/vnc/vncinput.hh"
#include "base/output.hh" //simout
+#include "base/trace.hh"
#include "debug/VNC.hh"
using namespace std;
diff -r 0fea324c832c -r b279bad40aa3 src/dev/intel_8254_timer.hh
--- a/src/dev/intel_8254_timer.hh Sat Nov 10 17:18:02 2012 -0600
+++ b/src/dev/intel_8254_timer.hh Fri Nov 16 10:27:47 2012 -0600
@@ -38,8 +38,9 @@
#include "base/bitunion.hh"
#include "base/types.hh"
+#include "base/trace.hh"
#include "debug/Intel8254Timer.hh"
-#include "sim/eventq.hh"
+#include "sim/eventq_impl.hh"
#include "sim/serialize.hh"
/** Programmable Interval Timer (Intel 8254) */
diff -r 0fea324c832c -r b279bad40aa3 src/dev/mc146818.hh
--- a/src/dev/mc146818.hh Sat Nov 10 17:18:02 2012 -0600
+++ b/src/dev/mc146818.hh Fri Nov 16 10:27:47 2012 -0600
@@ -33,7 +33,7 @@
#ifndef __DEV_MC146818_HH__
#define __DEV_MC146818_HH__
-#include "sim/eventq.hh"
+#include "sim/eventq_impl.hh"
/** Real-Time Clock (MC146818) */
class MC146818 : public EventManager
diff -r 0fea324c832c -r b279bad40aa3 src/mem/comm_monitor.cc
--- a/src/mem/comm_monitor.cc Sat Nov 10 17:18:02 2012 -0600
+++ b/src/mem/comm_monitor.cc Fri Nov 16 10:27:47 2012 -0600
@@ -38,6 +38,7 @@
* Andreas Hansson
*/
+#include "base/trace.hh"
#include "debug/CommMonitor.hh"
#include "mem/comm_monitor.hh"
#include "sim/stats.hh"
diff -r 0fea324c832c -r b279bad40aa3 src/mem/packet_queue.cc
--- a/src/mem/packet_queue.cc Sat Nov 10 17:18:02 2012 -0600
+++ b/src/mem/packet_queue.cc Fri Nov 16 10:27:47 2012 -0600
@@ -41,6 +41,7 @@
* Andreas Hansson
*/
+#include "base/trace.hh"
#include "debug/Drain.hh"
#include "debug/PacketQueue.hh"
#include "mem/packet_queue.hh"
diff -r 0fea324c832c -r b279bad40aa3 src/mem/packet_queue.hh
--- a/src/mem/packet_queue.hh Sat Nov 10 17:18:02 2012 -0600
+++ b/src/mem/packet_queue.hh Fri Nov 16 10:27:47 2012 -0600
@@ -56,8 +56,8 @@
#include <list>
#include "mem/port.hh"
-#include "sim/eventq.hh"
#include "sim/drain.hh"
+#include "sim/eventq_impl.hh"
/**
* A packet queue is a class that holds deferred packets and later
diff -r 0fea324c832c -r b279bad40aa3 src/mem/physical.cc
--- a/src/mem/physical.cc Sat Nov 10 17:18:02 2012 -0600
+++ b/src/mem/physical.cc Fri Nov 16 10:27:47 2012 -0600
@@ -50,6 +50,7 @@
#include <iostream>
#include <string>
+#include "base/trace.hh"
#include "debug/BusAddrRanges.hh"
#include "debug/Checkpoint.hh"
#include "mem/abstract_mem.hh"
diff -r 0fea324c832c -r b279bad40aa3 src/mem/ruby/network/Topology.cc
--- a/src/mem/ruby/network/Topology.cc Sat Nov 10 17:18:02 2012 -0600
+++ b/src/mem/ruby/network/Topology.cc Fri Nov 16 10:27:47 2012 -0600
@@ -28,6 +28,7 @@
#include <cassert>
+#include "base/trace.hh"
#include "debug/RubyNetwork.hh"
#include "mem/protocol/MachineType.hh"
#include "mem/ruby/common/NetDest.hh"
diff -r 0fea324c832c -r b279bad40aa3 src/mem/ruby/system/System.cc
--- a/src/mem/ruby/system/System.cc Sat Nov 10 17:18:02 2012 -0600
+++ b/src/mem/ruby/system/System.cc Fri Nov 16 10:27:47 2012 -0600
@@ -226,7 +226,7 @@
// Restore eventq head
eventq_head = eventq->replaceHead(eventq_head);
// Restore curTick
- curTick(curtick_original);
+ setCurTick(curtick_original);
uint8_t *raw_data = NULL;
@@ -357,7 +357,7 @@
// save the event queue head
Event* eventq_head = eventq->replaceHead(NULL);
// set curTick to 0 and reset Ruby System's clock
- curTick(0);
+ setCurTick(0);
resetClock();
// Schedule an event to start cache warmup
@@ -377,7 +377,7 @@
// Restore eventq head
eventq_head = eventq->replaceHead(eventq_head);
// Restore curTick and Ruby System's clock
- curTick(curtick_original);
+ setCurTick(curtick_original);
resetClock();
}
}
diff -r 0fea324c832c -r b279bad40aa3 src/mem/simple_dram.cc
--- a/src/mem/simple_dram.cc Sat Nov 10 17:18:02 2012 -0600
+++ b/src/mem/simple_dram.cc Fri Nov 16 10:27:47 2012 -0600
@@ -38,6 +38,7 @@
* Ani Udipi
*/
+#include "base/trace.hh"
#include "debug/Drain.hh"
#include "debug/DRAM.hh"
#include "debug/DRAMWR.hh"
diff -r 0fea324c832c -r b279bad40aa3 src/python/swig/event.i
--- a/src/python/swig/event.i Sat Nov 10 17:18:02 2012 -0600
+++ b/src/python/swig/event.i Fri Nov 16 10:27:47 2012 -0600
@@ -33,7 +33,7 @@
%{
#include "base/types.hh"
#include "python/swig/pyevent.hh"
-#include "sim/eventq.hh"
+#include "sim/eventq_impl.hh"
#include "sim/sim_events.hh"
#include "sim/sim_exit.hh"
#include "sim/simulate.hh"
diff -r 0fea324c832c -r b279bad40aa3 src/sim/clocked_object.hh
--- a/src/sim/clocked_object.hh Sat Nov 10 17:18:02 2012 -0600
+++ b/src/sim/clocked_object.hh Fri Nov 16 10:27:47 2012 -0600
@@ -47,6 +47,7 @@
#include "base/intmath.hh"
#include "params/ClockedObject.hh"
+#include "sim/core.hh"
#include "sim/sim_object.hh"
/**
diff -r 0fea324c832c -r b279bad40aa3 src/sim/core.cc
--- a/src/sim/core.cc Sat Nov 10 17:18:02 2012 -0600
+++ b/src/sim/core.cc Fri Nov 16 10:27:47 2012 -0600
@@ -35,11 +35,10 @@
#include "base/callback.hh"
#include "base/output.hh"
#include "sim/core.hh"
+#include "sim/eventq.hh"
using namespace std;
-Tick _curTick = 0;
-
namespace SimClock {
/// The simulated frequency of curTick(). (In ticks per second)
Tick Frequency;
diff -r 0fea324c832c -r b279bad40aa3 src/sim/core.hh
--- a/src/sim/core.hh Sat Nov 10 17:18:02 2012 -0600
+++ b/src/sim/core.hh Fri Nov 16 10:27:47 2012 -0600
@@ -39,12 +39,10 @@
#include <string>
#include "base/types.hh"
+#include "sim/eventq.hh"
/// The universal simulation clock.
-extern Tick _curTick;
-
-inline Tick curTick() { return _curTick; }
-inline void curTick(Tick newVal) { _curTick = newVal; }
+inline Tick curTick() { return mainEventQueue.getCurTick(); }
const Tick retryTime = 1000;
diff -r 0fea324c832c -r b279bad40aa3 src/sim/debug.cc
--- a/src/sim/debug.cc Sat Nov 10 17:18:02 2012 -0600
+++ b/src/sim/debug.cc Fri Nov 16 10:27:47 2012 -0600
@@ -36,7 +36,7 @@
#include "base/debug.hh"
#include "sim/debug.hh"
-#include "sim/eventq.hh"
+#include "sim/eventq_impl.hh"
#include "sim/sim_events.hh"
#include "sim/sim_exit.hh"
diff -r 0fea324c832c -r b279bad40aa3 src/sim/eventq.cc
--- a/src/sim/eventq.cc Sat Nov 10 17:18:02 2012 -0600
+++ b/src/sim/eventq.cc Fri Nov 16 10:27:47 2012 -0600
@@ -42,7 +42,7 @@
#include "cpu/smt.hh"
#include "debug/Config.hh"
#include "sim/core.hh"
-#include "sim/eventq.hh"
+#include "sim/eventq_impl.hh"
using namespace std;
@@ -201,6 +201,9 @@
// handle action
if (!event->squashed()) {
+ // forward current cycle to the time when this event occurs.
+ setCurTick(event->when());
+
event->process();
if (event->isExitEvent()) {
assert(!event->flags.isSet(Event::AutoDelete) ||
@@ -429,5 +432,5 @@
}
EventQueue::EventQueue(const string &n)
- : objName(n), head(NULL)
+ : objName(n), head(NULL), _curTick(0)
{}
diff -r 0fea324c832c -r b279bad40aa3 src/sim/eventq.hh
--- a/src/sim/eventq.hh Sat Nov 10 17:18:02 2012 -0600
+++ b/src/sim/eventq.hh Fri Nov 16 10:27:47 2012 -0600
@@ -44,7 +44,6 @@
#include "base/flags.hh"
#include "base/misc.hh"
-#include "base/trace.hh"
#include "base/types.hh"
#include "debug/Event.hh"
#include "sim/serialize.hh"
@@ -361,6 +360,7 @@
private:
std::string objName;
Event *head;
+ Tick _curTick;
void insert(Event *event);
void remove(Event *event);
@@ -379,6 +379,9 @@
void reschedule(Event *event, Tick when, bool always = false);
Tick nextTick() const { return head->when(); }
+ void setCurTick(Tick newVal) { _curTick = newVal; }
+ Tick getCurTick() { return _curTick; }
+
Event *serviceOne();
// process all events up to the given timestamp. we inline a
@@ -398,6 +401,8 @@
//assert(head->when() >= when && "event scheduled in the past");
serviceOne();
}
+
+ setCurTick(when);
}
// return true if no events are queued
@@ -476,68 +481,10 @@
{
eventq->reschedule(event, when, always);
}
+
+ void setCurTick(Tick newVal) { eventq->setCurTick(newVal); }
};
-inline void
-EventQueue::schedule(Event *event, Tick when)
-{
- assert(when >= curTick());
- assert(!event->scheduled());
- assert(event->initialized());
-
- event->setWhen(when, this);
- insert(event);
- event->flags.set(Event::Scheduled);
- if (this == &mainEventQueue)
- event->flags.set(Event::IsMainQueue);
- else
- event->flags.clear(Event::IsMainQueue);
-
- if (DTRACE(Event))
- event->trace("scheduled");
-}
-
-inline void
-EventQueue::deschedule(Event *event)
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev