From owner-freebsd-hackers Tue Aug 7 0:35:21 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from scaup.mail.pas.earthlink.net (scaup.mail.pas.earthlink.net [207.217.121.49]) by hub.freebsd.org (Postfix) with ESMTP id 7A62A37B403 for ; Tue, 7 Aug 2001 00:35:19 -0700 (PDT) (envelope-from tlambert2@mindspring.com) Received: from mindspring.com (dialup-209.245.136.130.Dial1.SanJose1.Level3.net [209.245.136.130]) by scaup.mail.pas.earthlink.net (EL-8_9_3_3/8.9.3) with ESMTP id AAA09371; Tue, 7 Aug 2001 00:35:17 -0700 (PDT) Message-ID: <3B6F9A5E.A58E9F31@mindspring.com> Date: Tue, 07 Aug 2001 00:35:58 -0700 From: Terry Lambert Reply-To: tlambert2@mindspring.com X-Mailer: Mozilla 4.7 [en]C-CCK-MCD {Sony} (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: Jeff Behl Cc: "'freebsd-hackers@freebsd.org'" Subject: Re: timing question References: <0307F3737A2AD511A42200D0B7A071919A402F@dopey.corp.expertcity.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Jeff Behl wrote: > please excuse and direct me to the right place if this isn't the appropriate > place to post this sort of question.... > > we're looking into moving to freebsd (yea!), but found the following > problem. It seems that the shortest amount of time the below code will > sleep for is 20 seconds! any call to nanosleep for 5,10, etc miliseconds > returns a 20 ms delay. are we doing something wrong? You appear to be measuring the quantum. You can decrease the quantum size via sysctl, or at compile time. Realize that your timing is tight enough that if you are running any other code, you can't expect that your process will get the quantum next, unless you use rtprio. Also note that your timer granularity might be someone less than you would expect: in other words it could be returning before, but since the sleep is woken up as the result of a timer interrupt firing, you may need to increase the rate your clock runs at (search for "HZ" in /sys/i386/conf/LINT) to make your timer interrupts faster, which will in turn increase your timeout resolution. -- Terry To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message