• Daniel Black's avatar
    MDEV-23175: my_timer_milliseconds ftime deprecated - clock_gettime replacement · 20512a68
    Daniel Black authored
    Linux glibc has deprecated ftime resutlting in a compile error on Fedora-32.
    
    Per manual clock_gettime is the suggested replacement. Because my_timer_milliseconds
    is a relative time used by largely the perfomrance schema, CLOCK_MONOTONIC_COARSE
    is used. This has been available since Linux-2.6.32.
    
    The low overhead is shows in the unittest:
    
        $ unittest/mysys/my_rdtsc-t
        1..11
        # ----- Routine ---------------
        # myt.cycles.routine          :             5
        # myt.nanoseconds.routine     :            11
        # myt.microseconds.routine    :            13
        # myt.milliseconds.routine    :            18
        # myt.ticks.routine           :            17
        # ----- Frequency -------------
        # myt.cycles.frequency        :    3596597014
        # myt.nanoseconds.frequency   :    1000000000
        # myt.microseconds.frequency  :       1000000
        # myt.milliseconds.frequency  :          1039
        # myt.ticks.frequency         :           103
        # ----- Resolution ------------
        # myt.cycles.resolution       :             1
        # myt.nanoseconds.resolution  :             1
        # myt.microseconds.resolution :             1
        # myt.milliseconds.resolution :             1
        # myt.ticks.resolution        :             1
        # ----- Overhead --------------
        # myt.cycles.overhead         :           118
        # myt.nanoseconds.overhead    :           234
        # myt.microseconds.overhead   :           222
        # myt.milliseconds.overhead   :            30
        # myt.ticks.overhead          :          4946
        ok 1 - my_timer_init() did not crash
        ok 2 - The cycle timer is strictly increasing
        ok 3 - The cycle timer is implemented
        ok 4 - The nanosecond timer is increasing
        ok 5 - The nanosecond timer is implemented
        ok 6 - The microsecond timer is increasing
        ok 7 - The microsecond timer is implemented
        ok 8 - The millisecond timer is increasing
        ok 9 - The millisecond timer is implemented
        ok 10 - The tick timer is increasing
        ok 11 - The tick timer is implemented
    20512a68
configure.cmake 28.8 KB