Date: Sun, 28 Jan 1996 20:10:03 -0800 (PST) From: Bruce Evans <bde@zeta.org.au> To: freebsd-bugs Subject: Re: kern/975: getrusage returns negative deltas Message-ID: <199601290410.UAA25567@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/975; it has been noted by GNATS. From: Bruce Evans <bde@zeta.org.au> To: FreeBSD-gnats-submit@FreeBSD.ORG, hsu@freefall.freebsd.org Cc: Subject: Re: kern/975: getrusage returns negative deltas Date: Mon, 29 Jan 1996 15:01:39 +1100 >Two calls to getrusage(). The second call indicates that the process has >used less time resource then the first call. This is caused by the granularity of the sampling method. E.g., if a process has been running for precisely 30000 usec and has been sampled once in user mode and once in system mode, then getrusage() reports 15000 usec in user mode and 15000 usec in system mode. 30 microseconds later, after the process has been sampled once more in system mode, getrusage will report 10010 usec in user mode and 20020 usec in system mode. The time in user mode has apparently gone backwards by 4990 usec. This affect is only noticable when the sample counts are too small to be accurate. It would be too expensive to use non-statistical sampling. The clock would have to be read for every syscall/interrupt entry and exit. The times should be fudged so that they never appear to go backwards. Bruce
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199601290410.UAA25567>