diff options
author | phk <phk@FreeBSD.org> | 2006-03-09 09:33:17 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2006-03-09 09:33:17 +0000 |
commit | 15ba3472e195a28573f5086bece289e20bee7ac5 (patch) | |
tree | 194b2772e9b492c453bad4dce6c08196e14f9b9e | |
parent | 64b4ff03735a7d3774317537b959d5d30caf4c76 (diff) | |
download | FreeBSD-src-15ba3472e195a28573f5086bece289e20bee7ac5.zip FreeBSD-src-15ba3472e195a28573f5086bece289e20bee7ac5.tar.gz |
Add slop to "backwards" cpu accounting messages, 3 usec or 1% whichever
triggers.
This should eliminate all the trivial messages which result from minor
increases in cpu_tick frequency.
Machines which don't du cpu clock fiddling shouldn't issue "backwards"
messages now.
Laptops and other machines where the initial estimate of cputicks may be
waaaay off will still issue warnings.
-rw-r--r-- | sys/kern/kern_resource.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c index 16d1d5c..b527f14 100644 --- a/sys/kern/kern_resource.c +++ b/sys/kern/kern_resource.c @@ -779,7 +779,11 @@ calcru1(struct proc *p, struct rusage_ext *ruxp, struct timeval *up, uu = (tu * ut) / tt; su = (tu * st) / tt; iu = tu - uu - su; - if (tu < ptu) { + if (tu + 3 > ptu) { + /* Numeric slop for low counts */ + } else if (101 * tu > 100 * ptu) { + /* 1% slop for large counts */ + } else { printf( "calcru: runtime went backwards from %ju usec to %ju usec for pid %d (%s)\n", (uintmax_t)ptu, (uintmax_t)tu, p->p_pid, p->p_comm); |