summaryrefslogtreecommitdiff
path: root/sim
diff options
context:
space:
mode:
Diffstat (limited to 'sim')
-rw-r--r--sim/eventq.cc17
-rw-r--r--sim/sim_object.cc36
-rw-r--r--sim/sim_object.hh6
-rw-r--r--sim/stat_control.cc8
4 files changed, 61 insertions, 6 deletions
diff --git a/sim/eventq.cc b/sim/eventq.cc
index 6b4ccc827..f975c5e97 100644
--- a/sim/eventq.cc
+++ b/sim/eventq.cc
@@ -208,6 +208,13 @@ EventQueue::dump()
cprintf("============================================================\n");
}
+extern "C"
+void
+dumpMainQueue()
+{
+ mainEventQueue.dump();
+}
+
const char *
Event::description()
@@ -235,16 +242,18 @@ Event::trace(const char *action)
void
Event::dump()
{
+ cprintf("Event (%s)\n", description());
+ cprintf("Flags: %#x\n", _flags);
#if TRACING_ON
- cprintf(" Created: %d\n", when_created);
+ cprintf("Created: %d\n", when_created);
#endif
if (scheduled()) {
#if TRACING_ON
- cprintf(" Scheduled at %d\n", when_scheduled);
+ cprintf("Scheduled at %d\n", when_scheduled);
#endif
- cprintf(" Scheduled for %d\n", when());
+ cprintf("Scheduled for %d, priority %d\n", when(), _priority);
}
else {
- cprintf(" Not Scheduled\n");
+ cprintf("Not Scheduled\n");
}
}
diff --git a/sim/sim_object.cc b/sim/sim_object.cc
index 39219b500..818648b98 100644
--- a/sim/sim_object.cc
+++ b/sim/sim_object.cc
@@ -30,6 +30,7 @@
#include "base/callback.hh"
#include "base/inifile.hh"
+#include "base/match.hh"
#include "base/misc.hh"
#include "base/trace.hh"
#include "base/stats/events.hh"
@@ -53,13 +54,21 @@ using namespace std;
//
SimObject::SimObjectList SimObject::simObjectList;
+namespace Stats {
+ extern ObjectMatch event_ignore;
+}
+
//
// SimObject constructor: used to maintain static simObjectList
//
SimObject::SimObject(const string &_name)
: objName(_name)
{
- doRecordEvent = !Stats::ignoreEvent(_name);
+#ifdef DEBUG
+ doDebugBreak = false;
+#endif
+
+ doRecordEvent = !Stats::event_ignore.match(_name);
simObjectList.push_back(this);
}
@@ -172,6 +181,31 @@ SimObject::serializeAll(ostream &os)
}
}
+#ifdef DEBUG
+//
+// static function: flag which objects should have the debugger break
+//
+void
+SimObject::debugObjectBreak(const string &objs)
+{
+ SimObjectList::const_iterator i = simObjectList.begin();
+ SimObjectList::const_iterator end = simObjectList.end();
+
+ ObjectMatch match(objs);
+ for (; i != end; ++i) {
+ SimObject *obj = *i;
+ obj->doDebugBreak = match.match(obj->name());
+ }
+}
+
+extern "C"
+void
+debugObjectBreak(const char *objs)
+{
+ SimObject::debugObjectBreak(string(objs));
+}
+#endif
+
void
SimObject::recordEvent(const std::string &stat)
{
diff --git a/sim/sim_object.hh b/sim/sim_object.hh
index 770cd558e..dfd70f8ec 100644
--- a/sim/sim_object.hh
+++ b/sim/sim_object.hh
@@ -83,6 +83,12 @@ class SimObject : public Serializable
// static: call nameOut() & serialize() on all SimObjects
static void serializeAll(std::ostream &);
+#ifdef DEBUG
+ public:
+ bool doDebugBreak;
+ static void debugObjectBreak(const std::string &objs);
+#endif
+
public:
bool doRecordEvent;
void recordEvent(const std::string &stat);
diff --git a/sim/stat_control.cc b/sim/stat_control.cc
index 9a4313a61..8a8eaa790 100644
--- a/sim/stat_control.cc
+++ b/sim/stat_control.cc
@@ -80,6 +80,12 @@ statElapsedTime()
return elapsed();
}
+Tick
+statElapsedTicks()
+{
+ return curTick - startTick;
+}
+
SimTicksReset simTicksReset;
void
@@ -105,7 +111,7 @@ InitSimStats()
;
simTicks
- .scalar(curTick)
+ .functor(statElapsedTicks)
.name("sim_ticks")
.desc("Number of ticks simulated")
;