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

ForceTimeHighResolution switch doesn't operate as intended



    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Won't Fix
    • Affects Version/s: 5.0u6, 6
    • Fix Version/s: 8
    • Component/s: hotspot
    • Subcomponent:
    • CPU:
      generic, x86
    • OS:
      windows, windows_xp


      The fix for 4500388 introduced the ForceTimeHighResolution switch to cause the VM to request a 1ms timer interrupt period at startup, and restore the timer period at shutdown, and consequently to disable the per-sleep changing of the timer period that would otherwise occur. This was applied to 1.3.1_04+, 1.4.0_02+, 5.0+ and 6.

      However, the code to change the timer was placed in DllMain and at the time it is executed the command-line switches have not been processed and so ForceTimeHighResolution is always seen to be false at that stage and hence the timer period is never set to 1ms. Because the flag also disables per-sleep changes to the timer, the net result is that use of this flag actually disables all use of the high-resolution timer for sleep purposes.

      You can use perfmon, on Windows, to display the interrupts/sec that the system is experiencing. Select a scale factor of 1 and set the Y axis to cover 0-1000. Under a normal 10ms timer period you will see around 100+ interrupts/sec. With the 1ms timer period you will see this shoot up to 1000+ interrupts/sec.

      NOTE: Changing the timer period is a system wide action and so Windows operates the timer at the shortest period requested by any running application. On some systems you will find that some other piece of software has already set a 1ms period and so the operation of the VM, with or without ForceTimeHighresolution, has no effect on the timer period.

      Edited to stop the censoring software from changing "axis" to "customer"


          Issue Links



              dholmes David Holmes
              dholmes David Holmes
              0 Vote for this issue
              5 Start watching this issue