* Nathan Binkert
*/
-#include <cassert>
+#include "sim/sim_object.hh"
-#include "base/callback.hh"
-#include "base/inifile.hh"
+#include "base/logging.hh"
#include "base/match.hh"
-#include "base/misc.hh"
#include "base/trace.hh"
-#include "base/types.hh"
#include "debug/Checkpoint.hh"
-#include "sim/sim_object.hh"
-#include "sim/stats.hh"
+#include "sim/probe/probe.hh"
using namespace std;
// SimObject constructor: used to maintain static simObjectList
//
SimObject::SimObject(const Params *p)
- : EventManager(p->eventq), _params(p)
+ : EventManager(getEventQueue(p->eventq_index)), _params(p)
{
#ifdef DEBUG
doDebugBreak = false;
#endif
-
simObjectList.push_back(this);
- state = Running;
+ probeManager = new ProbeManager(this);
+}
+
+SimObject::~SimObject()
+{
+ delete probeManager;
}
void
}
void
-SimObject::loadState(Checkpoint *cp)
+SimObject::loadState(CheckpointIn &cp)
{
- if (cp->sectionExists(name())) {
+ if (cp.sectionExists(name())) {
DPRINTF(Checkpoint, "unserializing\n");
- unserialize(cp, name());
+ // This works despite name() returning a fully qualified name
+ // since we are at the top level.
+ unserializeSection(cp, name());
} else {
DPRINTF(Checkpoint, "no checkpoint section found\n");
}
}
void
-SimObject::regFormulas()
+SimObject::resetStats()
{
}
+/**
+ * No probe points by default, so do nothing in base.
+ */
void
-SimObject::resetStats()
+SimObject::regProbePoints()
{
}
+/**
+ * No probe listeners by default, so do nothing in base.
+ */
+void
+SimObject::regProbeListeners()
+{
+}
+
+ProbeManager *
+SimObject::getProbeManager()
+{
+ return probeManager;
+}
+
//
// static function: serialize all SimObjects.
//
void
-SimObject::serializeAll(ostream &os)
+SimObject::serializeAll(CheckpointOut &cp)
{
SimObjectList::reverse_iterator ri = simObjectList.rbegin();
SimObjectList::reverse_iterator rend = simObjectList.rend();
for (; ri != rend; ++ri) {
SimObject *obj = *ri;
- obj->nameOut(os);
- obj->serialize(os);
+ // This works despite name() returning a fully qualified name
+ // since we are at the top level.
+ obj->serializeSection(cp, obj->name());
}
}
}
#endif
-unsigned int
-SimObject::drain(Event *drain_event)
-{
- state = Drained;
- return 0;
-}
-
-void
-SimObject::resume()
-{
- state = Running;
-}
-
-void
-SimObject::setMemoryMode(State new_mode)
-{
- panic("setMemoryMode() should only be called on systems");
-}
-
-void
-SimObject::switchOut()
-{
- panic("Unimplemented!");
-}
-
-void
-SimObject::takeOverFrom(BaseCPU *cpu)
-{
- panic("Unimplemented!");
-}
-
-
SimObject *
SimObject::find(const char *name)
{