Class FrameStats

java.lang.Object
nl.colorize.multimedialib.renderer.FrameStats

public class FrameStats extends Object
Tracks performance statistics for each frame, then reports on average performance behavior over time using a sliding window.

The most essential performance information is the application's actual framerate, which is measured by the renderer itself. In addition, this class can be used to measure performance within each frame. The renderer will automatically measure frame update logic and rendering the frame, but this can be extended by registering additioanl application-specific statistics which are then also tracked every frame.

  • Field Details

  • Constructor Details

    • FrameStats

      public FrameStats(DisplayMode displayMode)
  • Method Details

    • markStart

      public void markStart(String phase)
    • markEnd

      public void markEnd(String phase)
    • getTargetFramerate

      public int getTargetFramerate()
    • getAverageFramerate

      public float getAverageFramerate()
    • getFrameUpdateTime

      public int getFrameUpdateTime()
    • getFrameRenderTime

      public int getFrameRenderTime()
    • getAverageTimeMS

      public int getAverageTimeMS(String phase)
      Returns the average duration for the specified phase, in milliseconds. The average is based on all previously measured frames that are currently in the buffer.
    • getAverageTime

      public float getAverageTime(String phase)
      Returns the average duration for the specified phase, in seconds. The average is based on all previously measured frames that are currently in the buffer.
    • getCustomStats

      public List<String> getCustomStats()
      Returns the names of all custom statistics that have been measured and are currently in the buffer. Note this does not return the standard performance statistics that are always measured.
    • getFrameTimes

      public Iterable<Long> getFrameTimes(String phase)
      Returns all measured frame times for the specified phase that are currently in the buffer, in millisecond precision. Frames are sorted so that the oldest frame is first, and the most recent frame is last.
    • getBufferSize

      public int getBufferSize()
      Returns the number of frames that have been measured and that are currently in the buffer.
    • countGraphics

      public void countGraphics(Graphic2D graphic)
    • resetGraphicsCount

      public void resetGraphicsCount()
    • getGraphicsCount

      public int getGraphicsCount()