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

add a flag to use result of gethrtime() directly in os::getTimeNanos() on Solaris and OS X

XMLWordPrintable

    • generic
    • os_x, solaris_10

      ###@###.### wrote:
       ...
      > Given gethrtime is _supposed_ to be monotonic and that bugs whereby
      > it is not monotonic get addressed, and given this code is actually
      > performance sensitive - as the changes in 6784100 demonstrated - then
      > shouldn't we add a flag AlwaysdUseOSHighResTime so that we just use
      > gethrtime() directly? This flag could be used by people who care
      > about the performance and know enough about it to check that they
      > have the right patches for gethrtime() to be assumed to be working
      > correctly. Default value of the flag would be false of course :)

      I did the experiment to return the result of gethrtime() without caching and got almost 6x improvement on x86!!!!!!

      inline hrtime_t getTimeNanos() {
        if (VM_Version::supports_cx8()) {
          const hrtime_t now = gethrtime();
      + if (UseNewCode) return now;

      I got ScaleHarness.java test from 6784100.

      32-bit product VM System.nanoTime()
      % gamma ScaleHarness -X 8 n

      -XX:-UseNewCode
      5614000 in 1010
      5612000 in 1010
      5613000 in 1010

      -XX:+UseNewCode
      31611000 in 1010
      31606000 in 1010
      31612000 in 1010

            Unassigned Unassigned
            kvn Vladimir Kozlov
            Votes:
            2 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: