AW: [uClinux-dev] usleep takes longer as expected
Phil Wilshire
pwilshire at cox.net
Mon Feb 4 12:08:15 EST 2008
Hi Siegfried
We get confused easily in the USA
For example
10.000 sometimes means 10 (as a float)
10,000 or 10000 normally means 10 times 1000
Anyway you can get your 1mS (1000usec) delay
if you add 15% to your cpuload by executing the timer tick 1000 time
every 1 Second.
(Thanks Harry for the measurement)
Phil Wilshire
Siegfried Müller wrote:
> Hi Chris,
>
> usleep(100) means 100usec, usleep(10000) means 10.000usec or 10ms.
> Cheers
> Siegfried
> -----Ursprüngliche Nachricht-----
> Von: uclinux-dev-bounces at uclinux.org
> [mailto:uclinux-dev-bounces at uclinux.org] Im Auftrag von Chris Doré
> Gesendet: Montag, 4. Februar 2008 17:10
> An: 'uClinux development list'
> Betreff: RE: [uClinux-dev] usleep takes longer as expected
>
>
> Do you mean 10msec? Your subject asks about usleep() taking more time
> than expected, but then your reported results show that it takes less
> time than expected.
>
>
> ..Chris
>
>> -----Original Message-----
>> From: uclinux-dev-bounces at uclinux.org [mailto:uclinux-dev-
>> bounces at uclinux.org] On Behalf Of Siegfried Müller
>> Sent: February 4, 2008 10:57 AM
>> To: 'uClinux development list'
>> Subject: [uClinux-dev] usleep takes longer as expected
>>
>> Hi,
>> I work with the snapgear distro 3.4 and uClibc.
>> I use usleep to wait for an exact time, but usleep takes a minimum of
>> 10.000usec. If i use usleep(100) it takes 10.000usec. Why?
>>
>> int main(int argc, char *argv[])
>> int i1=0;
>> struct timeval mytime;
>> struct timezone mytimezone;
>>
>> while(i1 < 10){
>> gettimeofday(&mytime,&mytimezone);
>> printf("Test %d, usec=%d,
>> sec=%d\n",i1,mytime.tv_usec,mytime.tv_sec);
>> usleep(100);
>> i1++;
>> }
>> }
>> Does anyone has an idea?
>> Cheers
>> Siegfried
>>
>> _______________________________________________
>> uClinux-dev mailing list
>> uClinux-dev at uclinux.org
>> http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
>> This message was resent by uclinux-dev at uclinux.org
>> To unsubscribe see:
>> http://mailman.uclinux.org/mailman/options/uclinux-dev
>
> _______________________________________________
> uClinux-dev mailing list
> uClinux-dev at uclinux.org
> http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
> This message was resent by uclinux-dev at uclinux.org
> To unsubscribe see:
> http://mailman.uclinux.org/mailman/options/uclinux-dev
>
> _______________________________________________
> uClinux-dev mailing list
> uClinux-dev at uclinux.org
> http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
> This message was resent by uclinux-dev at uclinux.org
> To unsubscribe see:
> http://mailman.uclinux.org/mailman/options/uclinux-dev
>
More information about the uClinux-dev
mailing list