diff options
Diffstat (limited to 'src/common/AsyncReserver.h')
-rw-r--r-- | src/common/AsyncReserver.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/common/AsyncReserver.h b/src/common/AsyncReserver.h index fa49cfab8b4..467e2570460 100644 --- a/src/common/AsyncReserver.h +++ b/src/common/AsyncReserver.h @@ -21,6 +21,7 @@ #include "common/Mutex.h" #include "common/Finisher.h" +#include "common/Formatter.h" /** * Manages a configurable number of asyncronous reservations. @@ -79,6 +80,33 @@ public: do_queues(); } + void dump(Formatter *f) { + Mutex::Locker l(lock); + f->dump_unsigned("max_allowed", max_allowed); + f->dump_unsigned("min_priority", min_priority); + f->open_array_section("queues"); + for (typename map<unsigned, list<pair<T, Context*> > > ::const_iterator p = + queues.begin(); p != queues.end(); ++p) { + f->open_object_section("queue"); + f->dump_unsigned("priority", p->first); + f->open_array_section("items"); + for (typename list<pair<T, Context*> >::const_iterator q = + p->second.begin(); q != p->second.end(); ++q) { + f->dump_stream("item") << q->first; + } + f->close_section(); + f->close_section(); + } + f->close_section(); + f->open_array_section("in_progress"); + for (typename set<T>::const_iterator p = in_progress.begin(); + p != in_progress.end(); + ++p) { + f->dump_stream("item") << *p; + } + f->close_section(); + } + /** * Requests a reservation * |