kern/17842: Erratic user time reports for long running processes

Bruce Evans bde at zeta.org.au
Wed Feb 2 02:00:44 PST 2005


The following reply was made to PR kern/17842; it has been noted by GNATS.

From: Bruce Evans <bde at zeta.org.au>
To: Kees Hendrikse <kees at echelon.nl>
Cc: freebsd-gnats-submit at FreeBSD.ORG
Subject: Re: kern/17842: Erratic user time reports for long running processes
Date: Wed, 2 Feb 2005 20:56:50 +1100 (EST)

 On Wed, 26 Apr 2000, Bruce Evans meant to Cc this to freebsd-gnats-submit
 but only Cced it to freebsd-bugs:
 
 [The submitter of the PR wrote:]
 > >  What baffles me most: why stop counting at 379265,687860 seconds?
 >
 > The multiplication in "uu = (tu * ut) / tt;" in kern_resource.c
 > overflows near there.  Here tu is the total time in usec, ut is the
 > user tick count and tt is the total tick count.  If all ticks are user
 > ticks, then overflow occurs for tu = sqrt(2^64 / 10^6 / hz) = 429496
 > seconds when hz = 100.  Normally there are some interrupt and system
 > ticks, so overflow occurs for a somewhat larger tu and a somewhat
 > smaller ut -- apparently about 379 / 429 times smaller in your case.
 >
 > 4.0 enforces monotonicity of the resource times, so truncated values
 > resulting from the overflow don't cause the resource times to stick
                               ^^^^^ oops, delete "don't" here
 > at the first value where overflow occurs.
 >
 > Bruce
 
 The factor of 379 / 429 was because I got hz and stathz mixed up.
 sqrt(2^64 / 10^6 / 128) is 379265.06...
 
 See PR 76972 for more details, except about the stickyness of the value.
 The value might not stick at the first overflowed value -- overflow just
 gives garbage values, and monotonicity limits the jitter caused by the
 garbage.
 
 Bruce


More information about the freebsd-bugs mailing list