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

Add MBean to monitor scenario's animation internals

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4
    • fx1.2
    • fx1.2
    • javafx
    • None

    Description

      I wanted to understand better what is going on with animation and to help that I implemented a JMX MBean and instrumented Scenario so we can gather some statistics on animation internals and check them via JMX client such as JConsole or VisualVM (mbean patch for marina/scenario is in the attachment). Gathering these data seems to be a very lightweight process and querying it while more computationally intensive hopefully should not affect the results that much. This JMX MBean is in default JMX domain and called AnimationPulse.

      Before going into details on what data is available through the MBean I'd like to outline our animation and painting model to make sure we are on the same page.

      We have a notion of heartbeats. They happen with certain time interval we call PULSE_DURATION (which in our case is 1sec / 60 by default). The idea is if we can get our animation&painting cycle (what we call pulse) to fit between heartbeats we have a stable frame-rate (which is 60 in our case by default).
      If for one reason or another we did not finish a pulse before the next heartbeat we skip a frame and that is something we want to avoid.

      In a nutshell pulse consists of the following events we might be interested in timing:

      pulseStart - the time pulse is started.

      note: For the convenience we measure everything from the beginning of the heartbeat interval the pulse was scheduled for.

      animationStart - the time MasterTimer started the animation. (It is so happened in our implementation it is the same as pulseStart.)

      animationEnd - the time MasterTimer is done with the animation.

      paintingStart - the time JSGPanel called paintImmediately(dirtyRegion)

      scenePaintingStart - the time JSGPanel.paintComponent called render for the scene

      scenePaintingEnd - the time scene rendering is done

      paintingEnd - the time JSGPanel call to paintImmediately(dirtyRegion) is done

      pulseEnd - the time pulse is ended.

      We say we skipped a frame if pulseEnd is greater or equal to the PULSE_DURATION. In fact we skipped pulseEnd / PULSE_DURATION frames.

      AnimationPulse MBean helps to record all these events and lets query different statistics such as averages and maximums on certain time intervals.

      properties and statistics available for querying are (all values are in millis):
      start - stands for pulseStart
      end - stands for pulseEnd
      animationDuration - stands for animationEnd - animationStart
      paintingDuration - stands for paintingEnd - paintingStart
      scenePaintingDuration - stands for scenePaintingEnd - scenePaintingStart
      pulseDuration - stands for pulseEnd - pulseStart
      paintingPreparationDuration - stands for scenePaintingStart - paintingStart
      skippedPulses - pulses we skipped

      paintingFinalizationDuration - stands for paintingEnd - scenePaintingEnd

      'foo'Max - stands for maximum of 'foo' for the duration of the program
      'foo'MaxIn1Sec - stands for maximum of 'foo' for the last 1 second
      'foo'Av - stands for average of 'foo' for the duration of the program
      'foo'AvIn100Millis - stands for average of 'foo' for the last 100 millis.

      One can connect to a running application using a JMX client to query the MBean. In the attachment there is a screen-shoot of visualVM with charts and everything connected to "Path Animation" sample from the netbeans6.5 FX samples.

      Attachments

        Issue Links

          Activity

            People

              idk Igor Kushnirskiy (Inactive)
              idk Igor Kushnirskiy (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported: