[Bug manual/17383] New: clock() documentation should say something about the implementation and the accuracy

vincent-srcware at vinc17 dot net sourceware-bugzilla@sourceware.org
Fri Sep 12 12:01:00 GMT 2014


https://sourceware.org/bugzilla/show_bug.cgi?id=17383

            Bug ID: 17383
           Summary: clock() documentation should say something about the
                    implementation and the accuracy
           Product: glibc
           Version: 2.20
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: manual
          Assignee: unassigned at sourceware dot org
          Reporter: vincent-srcware at vinc17 dot net
                CC: mtk.manpages at gmail dot com, roland at gnu dot org

The clock() documentation

  https://www.gnu.org/software/libc/manual/html_node/CPU-Time.html

should say something about the implementation and the accuracy (the code could
be better documented too), possibly with official references. This is in
relation to bug 12515, about the implementation change. In this bug, it is
said: "clock() should provide better precision". However the user doesn't seek
improved precision, but improved accuracy: if one gets more digits but the
value itself is less accurate (i.e. the error against the ideal value is
larger), this is bad. All this depends on the kernel implementation, but I
don't know anything about it.

In addition to improved precision, does one also get better accuracy?

I suppose yes, but the answer is not obvious.

Such a documentation is important, as the user may wonder: Should I use clock()
or something else?

Note that the clock(3) man page

  http://man7.org/linux/man-pages/man3/clock.3.html

says something about the implementation:

       In glibc 2.17 and earlier, clock() was implemented on top of
       times(2).  For improved precision, since glibc 2.18, it is
       implemented on top of clock_gettime(2) (using the
       CLOCK_PROCESS_CPUTIME_ID clock).

but with the poorly chosen reason "improved precision" instead of "improved
accuracy".

-- 
You are receiving this mail because:
You are on the CC list for the bug.



More information about the Glibc-bugs mailing list