Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 12 Oct 1997 16:02:20 +0100 (MET)
From:      Luigi Rizzo <luigi@labinfo.iet.unipi.it>
To:        itojun@itojun.org
Cc:        xaa@stack.nl, joerg_wunsch@uriah.heep.sax.de, freebsd-hackers@FreeBSD.ORG, denny1@home.com
Subject:   Re: wish /bin/sleep handled fractions of a second.
Message-ID:  <199710121502.QAA03647@labinfo.iet.unipi.it>
In-Reply-To: <10514.876671975@coconut.itojun.org> from "itojun@itojun.org" at Oct 13, 97 00:59:16 am

next in thread | previous in thread | raw e-mail | index | archive | help
> 	Is it so meaningful to provide very high resolution timing with
> 	sleep(1)?  There will be error in timing due to disk access
> 	for sleep(1) binary, process fork/exec time, and so forth.
> 	IMHO, 1/10sec resolution may worth it, but beyond that becoming more
> 	and more meaningless.

Good point. So I made some quick tests now on a P5133 with ide disk:

    prova# time ps  # first execution
    ... ps output
    0.007u 0.023s 0:00.14 14.2%     358+1000k 2+0io 8pf+0w

    prova# time ps  # second execution, so "ps" is in core
    ... ps output
    0.014u 0.014s 0:00.03 66.6%     152+492k 0+0io 0pf+0w

and...

    prova# time sleep 0
    0.000u 0.004s 0:00.00 0.0%      0+0k 0+0io 0pf+0w

Considering that those who use sleep(1) with sub-second resolution
presumably will run it from a warm file cache, then even nowadays it
might make sense to have 1ms of resolution. After all, at every scale
you look at, there is no guarantee that a process will complete within
a deadline.

	Cheers
	Luigi
-----------------------------+--------------------------------------
Luigi Rizzo                  |  Dip. di Ingegneria dell'Informazione
email: luigi@iet.unipi.it    |  Universita' di Pisa
tel: +39-50-568533           |  via Diotisalvi 2, 56126 PISA (Italy)
fax: +39-50-568522           |  http://www.iet.unipi.it/~luigi/
_____________________________|______________________________________



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199710121502.QAA03647>