Skip to content

Set the default to enable CPU clock for monotonic time tracking #2597

Description

@ranshid

back in redis/redis#7644 we introduced more efficient monotonic time tracking
which avoid using the clock_gettime posix which is running a vDSO syscall.
The expected improvements is expected to be ~x3 times faster time access (reduction from ~100ns to 10-30ns). However, we never set this config to be the default as stated in the code:

/* Using the processor clock (aka TSC on x86) can provide improved performance
 * throughout the server wherever the monotonic clock is used.  The processor clock
 * is significantly faster than calling 'clock_gettime' (POSIX).  While this is
 * generally safe on modern systems, this link provides additional information
 * about use of the x86 TSC: http://oliveryang.net/2015/09/pitfalls-of-TSC-usage
 *
 * To use the processor clock, either uncomment this line, or build with
 *   CFLAGS="-DUSE_PROCESSOR_CLOCK"
 * #define USE_PROCESSOR_CLOCK

The proposal here is to change the default compilation define to true (in case the CPU supports these instructions). we can avoid the CPU support testing during compile time as it is verified during the initialization of the clocks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions