From 32189b72391c6f255bd5d87151ecbb110a5282fe Mon Sep 17 00:00:00 2001 From: James Turner Date: Sat, 1 Sep 2018 18:08:16 +0100 Subject: [PATCH] Event-manager: add dump() method for debugging --- simgear/structure/event_mgr.cxx | 16 ++++++++++++++++ simgear/structure/event_mgr.hxx | 4 ++++ 2 files changed, 20 insertions(+) diff --git a/simgear/structure/event_mgr.cxx b/simgear/structure/event_mgr.cxx index 12e56d5d..435b18f8 100644 --- a/simgear/structure/event_mgr.cxx +++ b/simgear/structure/event_mgr.cxx @@ -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); + } +} diff --git a/simgear/structure/event_mgr.hxx b/simgear/structure/event_mgr.hxx index 41dc7b86..eaaec7f0 100644 --- a/simgear/structure/event_mgr.hxx +++ b/simgear/structure/event_mgr.hxx @@ -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;