[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: getrusage() problems with user vs. system time reporting
On Fri, Oct 28, 2011 at 07:24:03AM +0300, Jukka Ruohonen wrote:
> On Thu, Oct 27, 2011 at 08:05:41PM -0700, Greg A. Woods wrote:
> > The attached program seems to demonstrate the problem, in part, at least
> > to my eyes, on both NetBSD-4 (on real hardware) and NetBSD-5 (on
> > VirtualBox), and it also shows that the problem does not seem to exist
> > on Mac OS X (10.6.8).
> This is a well-known bug that is over 15 year old. The much simpler tests in
> atf(7) replicate it well. The used tracker PR is kern/30115. Michael van
> Elst suggested therein couple of reasonable (IMO) solutions.
I have though that getrusage() should remember the user and sys times
previously reported, and use those valuse to stop the reported values
If you are willing to take the cost of getting the timestamp (in
some units) on every kernel entry/exit (as well as the process switch)
then the time in usr/sys can be added to the clock tick counts and
used when the actual execution time is split.
(Doing it that way means the units don't have to be THAT accurate)
Other systems (including linux) don't even attempt to do fine-grained
excution times, and only report on where the clock tick interrupted
David Laight: david%l8s.co.uk@localhost
Main Index |
Thread Index |