diff options
author | Alan Conway <aconway@apache.org> | 2010-11-17 19:12:08 +0000 |
---|---|---|
committer | Alan Conway <aconway@apache.org> | 2010-11-17 19:12:08 +0000 |
commit | 09ff9252575e076375d1e414126466459c21e6d3 (patch) | |
tree | 092324a280d1f30487172b0defd90f66077c23fc /cpp/src/qpid/sys/Timer.cpp | |
parent | 881fc4aa64127af9a199b9d58d852f7ffe6bc79d (diff) | |
download | qpid-python-09ff9252575e076375d1e414126466459c21e6d3.tar.gz |
Aggregate Timer warnings.
The Timer code logs a warning if a timer callback is started late or
overruns the start time for the next callback. In cases where there
are a lot of these warnings, the time taken to do the logging itself
severly worsens the situation.
This commit aggregates timer warnings and give a statistical report
every 5 seconds at most.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1036169 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/sys/Timer.cpp')
-rw-r--r-- | cpp/src/qpid/sys/Timer.cpp | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/cpp/src/qpid/sys/Timer.cpp b/cpp/src/qpid/sys/Timer.cpp index 76e8b3dc0b..a97ccd1bd1 100644 --- a/cpp/src/qpid/sys/Timer.cpp +++ b/cpp/src/qpid/sys/Timer.cpp @@ -79,7 +79,8 @@ Timer::Timer() : active(false), late(50 * TIME_MSEC), overran(2 * TIME_MSEC), - lateCancel(500 * TIME_MSEC) + lateCancel(500 * TIME_MSEC), + warn(5 * TIME_SEC) { start(); } @@ -127,23 +128,15 @@ void Timer::run() if (!tasks.empty()) { overrun = Duration(tasks.top()->nextFireTime, end); } - if (delay > late) { - if (overrun > overran) { - QPID_LOG(warning, t->name << - " timer woken up " << delay / TIME_MSEC << - "ms late, overrunning by " << - overrun / TIME_MSEC << "ms [taking " << - Duration(start, end) << "]"); - } else { - QPID_LOG(warning, t->name << - " timer woken up " << delay / TIME_MSEC << - "ms late"); - } - } else if (overrun > overran) { - QPID_LOG(warning,t->name << - " timer callback overran by " << - overrun / TIME_MSEC << - "ms [taking " << Duration(start, end) << "]"); + bool warningsEnabled; + QPID_LOG_TEST(warning, warningsEnabled); + if (warningsEnabled) { + if (delay > late && overrun > overran) + warn.lateAndOverran(t->name, delay, overrun, Duration(start, end)); + else if (delay > late) + warn.late(t->name, delay); + else if (overrun > overran) + warn.overran(t->name, overrun, Duration(start, end)); } continue; } else { |