Event-manager: add dump() method for debugging

This commit is contained in:
James Turner
2018-09-01 18:08:32 +01:00
parent c192071f03
commit 32189b7239
2 changed files with 20 additions and 0 deletions
+16
View File
@@ -119,6 +119,14 @@ void SGEventMgr::removeTask(const std::string& name)
} }
} }
void SGEventMgr::dump()
{
SG_LOG(SG_GENERAL, SG_INFO, "EventMgr: sim-time queue:");
_simQueue.dump();
SG_LOG(SG_GENERAL, SG_INFO, "EventMgr: real-time queue:");
_rtQueue.dump();
}
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
// SGTimerQueue // SGTimerQueue
// This is the priority queue implementation: // This is the priority queue implementation:
@@ -270,3 +278,11 @@ SGTimer* SGTimerQueue::findByName(const std::string& name) const
return NULL; return NULL;
} }
void SGTimerQueue::dump()
{
for (int i=0; i < _numEntries; ++i) {
const auto t = _table[i].timer;
SG_LOG(SG_GENERAL, SG_INFO, "\ttimer:" << t->name << ", interval=" << t->interval);
}
}
+4
View File
@@ -38,6 +38,8 @@ public:
double nextTime() { return -_table[0].pri; } double nextTime() { return -_table[0].pri; }
SGTimer* findByName(const std::string& name) const; SGTimer* findByName(const std::string& name) const;
void dump();
private: private:
// The "priority" is stored as a negative time. This allows the // The "priority" is stored as a negative time. This allows the
// implementation to treat the "top" of the heap as the largest // implementation to treat the "top" of the heap as the largest
@@ -119,6 +121,8 @@ public:
void removeTask(const std::string& name); void removeTask(const std::string& name);
void dump();
private: private:
friend class SGTimer; friend class SGTimer;