mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-10 13:04:23 -04:00
EVENT_BASE_FLAG_PRECISE_TIMER indicates we want fine timer precision
There are a bunch of backends that can give us a reasonably good monotonic timer quickly, or a very precise monotonic timer less quickly. For example, Linux has CLOCK_MONOTONIC_COARSE (1msec precision), which is over twice as fast as CLOCK_MONOTONIC. Since epoll only lets you wait with 1msec precision, CLOCK_MONOTONIC_COARSE is a clear win. On Windows, you've got GetTickCount{,64}() which is fast, and QueryPerformanceCounter, which is precise but slow. Note that even in the cases where the underlying timer claims to have nanosecond resolution, we're still not exposing that via Libevent. Note also that "Precision" isn't the same as "Resolution" or "Accuracy". A timer's precision is the smallest change that the clock will register; a timer's resolution is the fineness of its underlying representation; a timer's accuracy is how much it drifts with respect to "Real Time", whatever that means. (Terms and definitions from PEP 418.)
This commit is contained in:
parent
1fbef7d538
commit
ddd69d391e
@ -481,7 +481,14 @@ enum event_base_config_flag {
|
|||||||
This flag has no effect if you wind up using a backend other than
|
This flag has no effect if you wind up using a backend other than
|
||||||
epoll.
|
epoll.
|
||||||
*/
|
*/
|
||||||
EVENT_BASE_FLAG_EPOLL_USE_CHANGELIST = 0x10
|
EVENT_BASE_FLAG_EPOLL_USE_CHANGELIST = 0x10,
|
||||||
|
|
||||||
|
/** Ordinarily, Libevent implements its time and timeout code using
|
||||||
|
the fastest monotonic timer that we have. If this flag is set,
|
||||||
|
however, we use less efficient more precise timer, assuming one is
|
||||||
|
present.
|
||||||
|
*/
|
||||||
|
EVENT_BASE_FLAG_PRECISE_TIMER = 0x20
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user