summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_resource.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2006-03-09 09:33:17 +0000
committerphk <phk@FreeBSD.org>2006-03-09 09:33:17 +0000
commit15ba3472e195a28573f5086bece289e20bee7ac5 (patch)
tree194b2772e9b492c453bad4dce6c08196e14f9b9e /sys/kern/kern_resource.c
parent64b4ff03735a7d3774317537b959d5d30caf4c76 (diff)
downloadFreeBSD-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.
Diffstat (limited to 'sys/kern/kern_resource.c')
-rw-r--r--sys/kern/kern_resource.c6
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);
OpenPOWER on IntegriCloud