From owner-freebsd-hackers Sun Oct 12 09:21:06 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id JAA29923 for hackers-outgoing; Sun, 12 Oct 1997 09:21:06 -0700 (PDT) (envelope-from owner-freebsd-hackers) Received: from labinfo.iet.unipi.it (labinfo.iet.unipi.it [131.114.9.5]) by hub.freebsd.org (8.8.7/8.8.7) with SMTP id JAA29912 for ; Sun, 12 Oct 1997 09:20:58 -0700 (PDT) (envelope-from luigi@labinfo.iet.unipi.it) Received: from localhost (luigi@localhost) by labinfo.iet.unipi.it (8.6.5/8.6.5) id QAA03647; Sun, 12 Oct 1997 16:02:20 +0100 From: Luigi Rizzo Message-Id: <199710121502.QAA03647@labinfo.iet.unipi.it> Subject: Re: wish /bin/sleep handled fractions of a second. To: itojun@itojun.org Date: Sun, 12 Oct 1997 16:02:20 +0100 (MET) Cc: xaa@stack.nl, joerg_wunsch@uriah.heep.sax.de, freebsd-hackers@FreeBSD.ORG, denny1@home.com In-Reply-To: <10514.876671975@coconut.itojun.org> from "itojun@itojun.org" at Oct 13, 97 00:59:16 am X-Mailer: ELM [version 2.4 PL23] Content-Type: text Sender: owner-freebsd-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk > 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/ _____________________________|______________________________________