Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8006942

Use CLOCK_MONOTONIC_RAW for nanoTime if available on Linux

    Details

    • Type: Enhancement
    • Status: Closed
    • Priority: P4
    • Resolution: Won't Fix
    • Affects Version/s: 9
    • Fix Version/s: 10
    • Component/s: hotspot
    • Labels:

      Description

      On 25/01/2013 5:42 PM, liang xie wrote:
      > "CLOCK_MONOTONIC_RAW" is available from 2.6.28+, it's a better choice while
      > ntp slew happened againt CLOCK_MONOTONIC_RAW. This's important for some
      > applications, e.g. zookeeper. Please see zookeeper--1616 for details.
      >
      >
      > diff -r 8389681cd7b1 src/os/linux/vm/os_linux.cpp
      > --- a/src/os/linux/vm/os_linux.cpp Tue Nov 15 16:44:09 2011 -0800
      > +++ b/src/os/linux/vm/os_linux.cpp Fri Jan 25 15:14:55 2013 +0800
      > @@ -1444,7 +1444,11 @@
      > jlong os::javaTimeNanos() {
      > if (Linux::supports_monotonic_clock()) {
      > struct timespec tp;
      > + #ifdef CLOCK_MONOTONIC_RAW
      > + int status = Linux::clock_gettime(CLOCK_MONOTONIC_RAW,&tp);
      > + #else
      > int status = Linux::clock_gettime(CLOCK_MONOTONIC,&tp);
      > + #endif
      > assert(status == 0, "gettime error");
      > jlong result = jlong(tp.tv_sec) * (1000 * 1000 * 1000) +
      > jlong(tp.tv_nsec);
      > return result;

      Unfortunately today our primary linux build platform is still at 2.6.27 so this would have to wait until we officially update that.

      But also we need to be able to run on earlier version so this would have to involve a dynamic runtime check not a simple compile-time check.

        Activity

        dholmes David Holmes created issue -
        mlautman Mary Lautman made changes -
        Field Original Value New Value
        Link This issue relates to PLAN-623 [ PLAN-623 ]
        mlautman Mary Lautman made changes -
        Labels time
        mlautman Mary Lautman made changes -
        Status New [ 10000 ] Open [ 1 ]
        mlautman Mary Lautman made changes -
        Fix Version/s 9 [ 14949 ]
        ctornqvi Christian Tornqvist made changes -
        Fix Version/s 10 [ 16302 ]
        Fix Version/s 9 [ 14949 ]
        dholmes David Holmes made changes -
        Assignee David Holmes [ dholmes ]
        dholmes David Holmes made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        Understanding Fix Understood [ 10001 ]
        dholmes David Holmes made changes -
        Affects Version/s 9 [ 14949 ]
        dholmes David Holmes made changes -
        Status In Progress [ 3 ] Open [ 1 ]
        dholmes David Holmes made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Understanding Fix Understood [ 10001 ]
        Resolution Won't Fix [ 2 ]
        ctornqvi Christian Tornqvist made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            dholmes David Holmes
            Reporter:
            dholmes David Holmes
          • Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: