diff options
author | Colin Patrick McCabe <cmccabe@alumni.cmu.edu> | 2010-11-03 15:36:09 -0700 |
---|---|---|
committer | Colin Patrick McCabe <cmccabe@alumni.cmu.edu> | 2010-11-03 21:40:24 -0700 |
commit | 0b9f2e2384e2d01882bbad70b2c4381f62df044b (patch) | |
tree | 5e2c89dcc37afeb325a9f82910b10b6629570b2e /src/common | |
parent | b0e737461a4f8825cef7991bd18567da13c2c739 (diff) | |
download | ceph-0b9f2e2384e2d01882bbad70b2c4381f62df044b.tar.gz |
Timer: add verbose debugging when debug timer = 20
Signed-off-by: Colin McCabe <colinm@hq.newdream.net>
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/Timer.cc | 33 | ||||
-rw-r--r-- | src/common/Timer.h | 2 |
2 files changed, 35 insertions, 0 deletions
diff --git a/src/common/Timer.cc b/src/common/Timer.cc index 07f68bc63b4..7b7530c3d83 100644 --- a/src/common/Timer.cc +++ b/src/common/Timer.cc @@ -26,6 +26,7 @@ #define DBL 10 +#include <sstream> #include <signal.h> #include <sys/time.h> #include <math.h> @@ -189,6 +190,7 @@ void Timer::add_event_at(utime_t when, Context *callback) if (i == scheduled.begin()) cond.Signal(); + dout(19) << show_all_events(__func__) << dendl; lock.Unlock(); } @@ -206,6 +208,8 @@ void Timer::cancel_all_events(void) { dout(DBL) << __PRETTY_FUNCTION__ << dendl; + dout(19) << show_all_events(__func__) << dendl; + lock.Lock(); cancel_all_events_impl(false); lock.Unlock(); @@ -227,6 +231,8 @@ int Timer::init() bool Timer::cancel_event_impl(Context *callback, bool cancel_running) { + dout(19) << show_all_events(__func__) << dendl; + event_lookup_map_t::iterator e = events.find(callback); if (e != events.end()) { // Erase the item out of the scheduled map. @@ -286,6 +292,33 @@ void Timer::pop_running(list <Context*> &running_, const utime_t &now) } } +std::string Timer::show_all_events(const char *caller) const +{ + ostringstream oss; + string sep; + oss << "show_all_events: from " << caller << ": scheduled ["; + for (scheduled_map_t::const_iterator s = scheduled.begin(); + s != scheduled.end(); + ++s) + { + oss << sep << s->first << "->" << s->second; + sep = ","; + } + oss << "] "; + + oss << "events ["; + string sep2; + for (event_lookup_map_t::const_iterator e = events.begin(); + e != events.end(); + ++e) + { + oss << sep2 << e->first << "->" << e->second->first; + sep2 = ","; + } + oss << "]"; + return oss.str(); +} + /******************************************************************/ SafeTimer::SafeTimer(Mutex &event_lock) : t(&event_lock) diff --git a/src/common/Timer.h b/src/common/Timer.h index 2efd3e04897..f19f3c74c52 100644 --- a/src/common/Timer.h +++ b/src/common/Timer.h @@ -80,6 +80,8 @@ private: void pop_running(std::list <Context*> &running_, const utime_t &now); + std::string show_all_events(const char *caller) const; + // This class isn't supposed to be copied Timer(const Timer &rhs); Timer& operator=(const Timer &rhs); |