summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2003-12-07 20:03:28 +0000
committerphk <phk@FreeBSD.org>2003-12-07 20:03:28 +0000
commit239117c33ff76d4b8885237984b4345bdf0d9c9d (patch)
treebf817b01d6bc366b442b1c574a10d5f866e2ed66 /sys/kern
parentf3326a4c713c944d11c27c73a1fc32aa129aa340 (diff)
downloadFreeBSD-src-239117c33ff76d4b8885237984b4345bdf0d9c9d.zip
FreeBSD-src-239117c33ff76d4b8885237984b4345bdf0d9c9d.tar.gz
Make the DIAGNOSTIC code which complains about long {call|time}out(9)
functions less noisy: We printf if a new function took longer than the previous record holder, or of the previous record holder took more than twice as long as the current record.
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_timeout.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/sys/kern/kern_timeout.c b/sys/kern/kern_timeout.c
index 738e615..106b670 100644
--- a/sys/kern/kern_timeout.c
+++ b/sys/kern/kern_timeout.c
@@ -158,6 +158,7 @@ softclock(void *dummy)
struct bintime bt1, bt2;
struct timespec ts2;
static uint64_t maxdt = 36893488147419102LL; /* 2 msec */
+ static timeout_t *lastfunc;
#endif
#ifndef MAX_SOFTCLOCK_STEPS
@@ -228,12 +229,17 @@ softclock(void *dummy)
binuptime(&bt2);
bintime_sub(&bt2, &bt1);
if (bt2.frac > maxdt) {
+ if (lastfunc != c_func ||
+ bt2.frac > maxdt * 2) {
+ bintime2timespec(&bt2, &ts2);
+ printf(
+ "Expensive timeout(9) function: %p(%p) %jd.%09ld s\n",
+ c_func, c_arg,
+ (intmax_t)ts2.tv_sec,
+ ts2.tv_nsec);
+ }
maxdt = bt2.frac;
- bintime2timespec(&bt2, &ts2);
- printf(
- "Expensive timeout(9) function: %p(%p) %ld.%09ld s\n",
- c_func, c_arg,
- (long)ts2.tv_sec, ts2.tv_nsec);
+ lastfunc = c_func;
}
#endif
if (!(c_flags & CALLOUT_MPSAFE))
OpenPOWER on IntegriCloud