]> sjero.net Git - iperf/commit
Timer Utilities
authorGerrit Renker <gerrit@erg.abdn.ac.uk>
Tue, 24 Feb 2009 19:30:50 +0000 (20:30 +0100)
committerGerrit Renker <gerrit@erg.abdn.ac.uk>
Tue, 24 Feb 2009 19:30:50 +0000 (20:30 +0100)
commitfad82d47d76abc8f4ac6767e58b89859ad35a2ca
treec4ec07510f6277980e70ddcb3e73dc5aafed86a0
parent0b373e070771aa2bc368ec82dbd4f48e69f5faf9
Timer Utilities

Apart from extending the Timestamp class (support for measuring elapsed
time and an `after' test), the main point of this patch is to update
the delay_loop() function.

The present implementation used a tight loop of continually calling
gettimeofday(2) until the specified amount of time has passed. This
is resource-intensive. In addition, while the loop worked reasonably
in many cases, it sometimes caused unwanted delays of 50 milliseconds
or more (process preempted?).

This has been replaced with nanosleep(2) as default now. The advantage
of nanosleep over the old solution is that signals are blocked and it
seems a much more robust solution.

Also, nanosleep uses the hrtimers interface internally
(/usr/src/davem-2.6/Documentation/hrtimers/hrtimers.txt).

For people who would like to keep the old behaviour, #ifdefs with
alternatives have been added.
compat/delay.cpp
include/Timestamp.hpp