diff options
author | Andy Schwerin <schwerin@10gen.com> | 2012-04-20 17:45:13 -0400 |
---|---|---|
committer | Andy Schwerin <schwerin@10gen.com> | 2012-04-23 16:11:11 -0400 |
commit | 84614c30a3cf272c6ca2a975421a445b026915c2 (patch) | |
tree | 1eee04e66c2b161be6da20c14f25c2d4acfd9566 /src/mongo/util/timer-inl.h | |
parent | 5173201c78db71eb99527d2c3b4c4a6dc5c25224 (diff) | |
download | mongo-84614c30a3cf272c6ca2a975421a445b026915c2.tar.gz |
SERVER-5557: Higher performance timer on Linux.
Also supports systems that implement POSIX's clock_gettime() (i.e., FreeBSD).
Diffstat (limited to 'src/mongo/util/timer-inl.h')
-rw-r--r-- | src/mongo/util/timer-inl.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/mongo/util/timer-inl.h b/src/mongo/util/timer-inl.h index 20a014d6276..2616cb7b038 100644 --- a/src/mongo/util/timer-inl.h +++ b/src/mongo/util/timer-inl.h @@ -25,8 +25,24 @@ #pragma once +#if defined(MONGO_HAVE_HEADER_UNISTD_H) +#include <unistd.h> +#endif + #if defined(_WIN32) + +// On Windows, prefer the Windows-specific implementation, which employs QueryPerformanceCounter. #include "mongo/util/timer-win32-inl.h" + +#elif defined(_POSIX_TIMERS) and _POSIX_TIMERS > 0 and defined(_POSIX_MONOTONIC_CLOCK) and _POSIX_MONOTONIC_CLOCK > 0 + +// On systems that support the POSIX clock_gettime function, and the "monotonic" clock, +// use those. +#include "mongo/util/timer-posixclock-inl.h" + #else + +// If all else fails, fall back to a generic implementation. Performance may suffer. #include "mongo/util/timer-generic-inl.h" + #endif |