[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: why is poll+gettimeofday so slow?
- To: Gustavo Vieira Gonçalves Coelho Rios <gustavo.rios@terra.com.br>
- Subject: Re: why is poll+gettimeofday so slow?
- From: julien Touche <julien.touche@lycos.com>
- Date: Sun, 01 Dec 2002 10:18:14 +0100
- Cc: misc@openbsd.org
- References: <3DE9865B.4B0CEFBD@terra.com.br>
- User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.2) Gecko/20021126
Gustavo Vieira Gonçalves Coelho Rios wrote:
> I am trying to discover how much time elapsed between two gettimeofday
> after a sleep of 1 milisecond (10 ^ -3 seconds)
>
> I got surprised when i ran it.
>
> Altough i asked poll to wait just 1 milisecond, the difference between
> the timestamp where always higher the 10 miliseconds! Of course i tried
> select, but it is even far from delivering microseconds precision.
>
> How may i get my select/poll/gettimeofday performance improved?
>
> Thanks for your time and cooperation.
>
> PS: If you have real time requirements (not worse than a microsecond);
> how would you do?
you got the tick (or kernel var HZ which is 10 ms on most system) and on
most system it's the best you can have without improvements on
scheduling/realtime.
I don't study the problem on OpenBSD but on linux you can use
high-resolution timer patch (on sourceforge) to get it (depend on your
system, resolution will depend on TSC, which has the best resolution,
and be 1/f in theory). I tested it and it's quiet good.
may be, you can explain more your problem ? realtime app ?
I'm not aware of any "realtime" dev on OpenBSD (please correct me if i'm
wrong)
Regards
Julien Touche