CVSROOT:        /cvs
Module name:    src
Changes by:     [email protected] 2019/10/26 15:16:38

Modified files:
        sys/kern       : kern_time.c kern_tc.c 
        sys/sys        : timetc.h 

Log message:
clock_getres(2): actually return the resolution of the given clock

Currently we return (1000000000 / hz) from clock_getres(2) as the
resolution for every clock.  This is often untrue.

For CPUTIME clocks, if we have a separate statclock interrupt the
resolution is (1000000000 / stathz).  Otherwise it is as we currently
claim: (1000000000 / hz).

For the REALTIME/MONOTONIC/UPTIME/BOOTTIME clocks the resolution is
that of the active timecounter.  During tc_init() we can compute the
precision of a timecounter by examining its tc_counter_mask and store
it for lookup later in a new member, tc_precision.  The resolution of
a clock backed by a timecounter "tc" is then

tc.tc_precision * (2^64 / tc.tc_frequency)

fractional seconds.

While here we can clean up sys_clock_getres() a bit.

Standards input from guenther@.  Lots of input, feedback from
kettenis@.

ok kettenis@

Reply via email to