diff options
author | Nick Mathewson <nickm@torproject.org> | 2012-04-26 16:22:03 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2012-04-26 16:42:21 -0400 |
commit | 26c75828b75e4c14fbbdce9212d3114d9926af1f (patch) | |
tree | cd1322987378cb5a9b81299da5b23f9977a13447 /test/test.sh | |
parent | 7428c78a959210951409803455092edff4bdea35 (diff) | |
download | libevent-26c75828b75e4c14fbbdce9212d3114d9926af1f.tar.gz |
When PRECISE_TIMERS is set with epoll, use timerfd for microsecond precision
The epoll interface ordinarily gives us one-millisecond
precision, so on Linux it makes perfect sense to use the
CLOCK_MONOTONIC_COARSE timer. But when the user has set the new
PRECISE_TIMER flag for an event_base (either by the
EVENT_BASE_FLAG_PRECISE_TIMER flag, or by the EVENT_PRECISE_TIMER
environment variable), they presumably want finer granularity.
On not-too-old Linuxes, we can achieve this using the Timerfd
mechanism, which accepts nanosecond granularity and understands
posix clocks. It's a little more expensive than just calling
epoll_wait(), so we won't do it by default.
Diffstat (limited to 'test/test.sh')
-rwxr-xr-x | test/test.sh | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/test/test.sh b/test/test.sh index 5a4efaba..59748c00 100755 --- a/test/test.sh +++ b/test/test.sh @@ -42,6 +42,7 @@ setup () { eval "EVENT_NO$i=yes; export EVENT_NO$i" done unset EVENT_EPOLL_USE_CHANGELIST + unset EVENT_PRECISE_TIMER } announce () { @@ -112,16 +113,24 @@ do_test() { unset EVENT_NO$1 if test "$2" = "(changelist)" ; then EVENT_EPOLL_USE_CHANGELIST=yes; export EVENT_EPOLL_USE_CHANGELIST + elif test "$2" = "(timerfd)" ; then + EVENT_PRECISE_TIMER=1; export EVENT_PRECISE_TIMER + elif test "$2" = "(timerfd+changelist)" ; then + EVENT_EPOLL_USE_CHANGELIST=yes; export EVENT_EPOLL_USE_CHANGELIST + EVENT_PRECISE_TIMER=1; export EVENT_PRECISE_TIMER fi + run_tests } announce "Running tests:" +do_test EPOLL "(timerfd)" +do_test EPOLL "(changelist)" +do_test EPOLL "(timerfd+changelist)" for i in $BACKENDS; do do_test $i done -do_test EPOLL "(changelist)" if test "$FAILED" = "yes"; then exit 1 |