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

os::elapsedVTime() is not consistent across platforms

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P3 P3
    • tbd
    • 9
    • hotspot
    • gc
    • generic
    • generic

      This bug is a followup of JDK-8160350 - cannot truss jdk9 [ solaris ]. During investigation of that bug it became clear that the implementation, behaviour and usage of os::elapsedVTime() and the associated functions os::supports_vtime(), os::enable_vtime() and os::vtime_enabled() are inconsistent between platforms.

      The issues are:

      * Calls to os::elapsedVTime() are not being guarded in some places by a call to os::supports_vtime(), e.g. G1CMTask::do_marking_step() / G1CMTask::regular_clock_call()

      * When thread CPU time is unavailable on a particular platform (e.g. BSD), total process CPU time is used instead, so on BSD the GC marking tasks may expire much earlier than on other platforms.

      * If the underlying system call to get vtime fails, platforms may either return 0 or fall back to returning total process CPU time. That means that delta calculations based on sucessive values returned by os::elapsedVTime() could give bizarre results.

      This area needs looking at carefully and decisions making about what the required cross-platform behaviour should be before the code is cleaned up.

      See also the discussion at http://mail.openjdk.java.net/pipermail/hotspot-dev/2016-July/023784.html

            Unassigned Unassigned
            alanbur Alan Burlison
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: