Sorry by "call" I meant call to gettimeofday, not the poll call.

So for example, if the timeout is 100ms.
It starts by very briefly presuming that there's no loop, so it starts
calling it on "every" poll call. If a loop has been detected (i.e. 4+
poll calls at regular intervals), it uses the time between calls (e.g.
10 nanoseconds) to defer the next gettimeofday call to e.g. 98ms (i.e.
it doesn't call gettimeofday until the next 98,000,000th repetition)
and then it uses the time elapsed since that last gettimeofday call
(recorded 98,000,000 repetitions ago) to give us an updated loop
speed, and how many repetitions until the next gettimeofday should be
called again (e.g. to aim now for 99.99999ms, don't call gettimeofday
until the 1,999,999th repetition ), and so on.

>> It could use the time since the last call to determine the speed of
>> the polling loop, ...
>
> That's the point. If you want to know the time since the last call you have
> to call gettimeofday => performance penalty.
>
_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to