Jeff Janes <jeff.janes@gmail.com> writes:
> On Thu, Nov 8, 2012 at 12:36 PM, Jeff Janes <jeff.janes@gmail.com> wrote:
>> Should gettimeofday be called before and after the poll() and then the
>> difference deducted from timeout?
> Something like this?
Meh. Not like that, because
(1) we shouldn't add overhead when no timeout is requested.
(2) it'd be better to do only one gettimeofday at the start and then
one in the EINTR path, not one per loop; this saves syscalls and also
avoids slippage of the timeout time.
(3) the select() path needs a similar fix.
But I think you have a good idea to use the INSTR_TIME macros instead
of custom code, even though this is Unix-only so there's not more than
one underlying implementation.
Will fix this up and commit.
regards, tom lane