MT#62181 wheeltimer: add logging

Annotate timer operations with debug logging. These are taken from
RegistrationTimer.

Change-Id: Ic0eac4b1cc529f416340d74b7c69e162421812a7
mr13.3.1
Richard Fuchs 1 year ago
parent d78b38db8e
commit 7e59c46309

@ -116,6 +116,8 @@ void _wheeltimer::run()
void _wheeltimer::process_current_timers(timer_list& list, std::unique_lock<std::mutex>& lock)
{
DBG("firing %zd timers\n", list.size());
while (!list.empty()) {
auto* t = list.front();
@ -124,6 +126,7 @@ void _wheeltimer::process_current_timers(timer_list& list, std::unique_lock<std:
// safe to unlock now
lock.unlock();
DBG("firing timer [%p]\n", t);
t->fire();
lock.lock();
@ -170,6 +173,9 @@ void _wheeltimer::place_timer(timer* t, uint64_t us, uint64_t latest)
break; // can't get much better
}
}
DBG("found bucket %" PRIu64 " with least load %zd (between %" PRIu64 " and %" PRIu64 ")\n",
bucket, least, us, latest);
}
add_timer_to_bucket(t, bucket);
@ -178,11 +184,16 @@ void _wheeltimer::place_timer(timer* t, uint64_t us, uint64_t latest)
void _wheeltimer::add_timer_to_bucket(timer* t, uint64_t bucket)
{
t->link(buckets[bucket]);
DBG("inserted timer [%p] in bucket %" PRIu64 " (now sized %zd)\n",
t, bucket, buckets[bucket].size());
}
void _wheeltimer::delete_timer(timer* t)
{
t->disarm();
if (t->disarm())
DBG("successfully removed timer [%p]\n", t);
else
DBG("timer [%p] not found for removing\n", t);
delete t;
}

@ -86,14 +86,17 @@ private:
pos = list->begin();
}
void disarm()
bool disarm()
{
expires = 0;
if (list) {
list->erase(pos);
list = NULL;
return true;
}
return false;
}
uint64_t expires; // absolute, microseconds, set after arming timer

Loading…
Cancel
Save