https://issues.dlang.org/show_bug.cgi?id=13433

--- Comment #8 from Marco Leise <marco.le...@gmx.de> ---
I just ran a test:

void main(string[] args)
{
    while (true)
    {
        timespec time;
        clock_gettime(CLOCK_REALTIME_COARSE, &time);
        printf(":%03ld ms\n", time.tv_nsec / 1_000_000);
    }
}

My kernel has CONFIG_HZ=1000 and CONFIG_NO_HZ=y (tick-less). The coarse timer
shows a precise 1 ms precision. What's more, compared to the fine grained
timer, it is ~100 times faster (!) [compiled with DMD and release options,
Core2Duo 2Ghz]:

1024 ms for 100,000,000 calls to the coarse real-time clock.
1059 ms for   1,000,000 calls to the regular real-time clock.

If your code benefits much from the 100 times faster time queries, millisecond
precision is a good trade off.

--

Reply via email to