Event-manager: add dump() method for debugging

This commit is contained in:
James Turner
2018-09-01 18:08:16 +01:00
parent c192071f03
commit 32189b7239
2 changed files with 20 additions and 0 deletions

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
// This is the priority queue implementation:
@@ -270,3 +278,11 @@ SGTimer* SGTimerQueue::findByName(const std::string& name) const
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);
}
}

View File

@@ -38,6 +38,8 @@ public:
double nextTime() { return -_table[0].pri; }
SGTimer* findByName(const std::string& name) const;
void dump();
private:
// The "priority" is stored as a negative time. This allows the
// implementation to treat the "top" of the heap as the largest
@@ -119,6 +121,8 @@ public:
void removeTask(const std::string& name);
void dump();
private:
friend class SGTimer;