X-Spam-Check-By: sourceware.org
DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed;         d=gmail.com; s=beta;         h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references;         b=Shh1h7vvcFyhzM764RWWG8iPjuAyXOlCTEygu5OImwbuPqoKLLffkq20stmZ4sbIuS1QponsBNDHlApxzYvfwl7ftE4Bbd8juMw6HN/Jdj9BRVN+gl+EeYZNcORwnUJC3EzgXcwXPcLfzDY2torEjVqSs3y3zasKeeow/9s5q3Y=
Message-ID: <ba40711f0702260647w127f2c26se19d8a002bfec14a@mail.gmail.com>
Date: Mon, 26 Feb 2007 09:47:05 -0500
From: "Lev Bishop" <lev.bishop@gmail.com>
To: cygwin@cygwin.com
Subject: Re: does usleep() sleep more than it's supposed to?
In-Reply-To: <45E292D6.30906@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
References: <45E292D6.30906@gmail.com>
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
Precedence: bulk
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie.com@cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

On 2/26/07, Carlo Florendo  wrote:
> I'm writing an application that requires time precisions up to the
> microsecond level.  However, I put a hard-coded adjustment of
> 9000 microseconds since usleep() seems to sleep on the average of
> 9000 microseconds more than it's supposed to, at least on my
> system.  I could work with up to 2000 microseconds for
> function overhead but 9000 microseconds seems to be too long.
>
> I've attached a simple test case that let's usleep() sleep at
> 100000 microseconds at each call.
>
> I've also included the output of cygcheck -svr.
>
> The output of the attached code on my system is the following:

FWIW, I don't see this:
Print elapsed time at every call to usleep()
Elapsed time (sec:microsec) 0:101000
Elapsed time (sec:microsec) 0:100000
Elapsed time (sec:microsec) 0:101000
Elapsed time (sec:microsec) 0:101000
Elapsed time (sec:microsec) 0:100000
Elapsed time (sec:microsec) 0:101000
Elapsed time (sec:microsec) 0:100000
Elapsed time (sec:microsec) 0:101000
Elapsed time (sec:microsec) 0:101000
Elapsed time (sec:microsec) 0:100000

Print elapsed after the loop()
Elapsed time (sec:microsec) 0:100000

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

