[Bug 228669] CLOCK_PROCESS_CPUTIME_ID is unnecessarily inaccurate

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Sat Jun 2 06:21:46 UTC 2018


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=228669

            Bug ID: 228669
           Summary: CLOCK_PROCESS_CPUTIME_ID is unnecessarily inaccurate
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs at FreeBSD.org
          Reporter: cperciva at FreeBSD.org

clock_gettime(CLOCK_PROCESS_CPUTIME_ID) is far less accurate than
clock_gettime(CLOCK_PROF), even though it seems that they should theoretically
measure the same thing:

     CLOCK_PROF
             Increments when the CPU is running in user or kernel mode.
     CLOCK_PROCESS_CPUTIME_ID
             Returns the execution time of the calling process.

It looks like this is due to CLOCK_PROF (aka. calcru) adding time from the
current time slice, while CLOCK_PROCESS_CPUTIME_ID (aka. get_process_cputime
aka rufetch) does not.

Since CLOCK_PROCESS_CPUTIME_ID is the version mandated by POSIX, it would be
nice if it were at least as accurate as the historical BSD profiling clock ID.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list