This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: does usleep() sleep more than it's supposed to?


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]