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

Uncontrolled Frame Rate in AnimationTimer

XMLWordPrintable

    • x86_64
    • linux_ubuntu

      FULL PRODUCT VERSION :
      java version "1.8.0_144"
      Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
      Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)


      ADDITIONAL OS VERSION INFORMATION :
      Linux Ubuntu8G 4.11.0-kfd-compute-rocm-rel-1.6-180 #1 SMP Tue Oct 10 08:15:38 CDT 2017 x86_64 x86_64 x86_64 GNU/Linux


      A DESCRIPTION OF THE PROBLEM :
      When I run the AnimationTimer class, it runs at an controlled FPS (ranges from 2000 to 30). However when I add the line -Dquantum.multithreaded=false to the run configurations, the problem is solved (FPS remains at around 60).

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Create a AnimationTimer in your application and measure the frame rate inside the AnimationTimer (1E9/deltaTime). Run the program. See code below.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The FPS should be around 60 or below.
      ACTUAL -
      The FPS was very irregular, jumping from 2000 to around 60.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      prevTime = System.nanoTime();
      AnimationTimer timer = new AnimationTimer() {
      @Override
      public void handle(long curTime) {
      double deltaTime = (curTime - prevTime) / 1E9;
                      System.out.println(1/deltaTime);
      }
      };
      timer.start();
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      -Dquantum.multithreaded=false in run configuration.

      SUPPORT :
      YES

            kcr Kevin Rushforth
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: