Class FrameStats
java.lang.Object
nl.colorize.multimedialib.renderer.FrameStats
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 Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
countGraphics
(Graphic2D graphic) float
float
getAverageTime
(String phase) Returns the average duration for the specified phase, in seconds.int
getAverageTimeMS
(String phase) Returns the average duration for the specified phase, in milliseconds.int
Returns the number of frames that have been measured and that are currently in the buffer.Returns the names of all custom statistics that have been measured and are currently in the buffer.int
getFrameTimes
(String phase) Returns all measured frame times for the specified phase that are currently in the buffer, in millisecond precision.int
int
int
void
void
void
-
Field Details
-
PHASE_FRAME_TIME
- See Also:
-
PHASE_FRAME_UPDATE
- See Also:
-
PHASE_FRAME_RENDER
- See Also:
-
BUFFER_CAPACITY
public static final int BUFFER_CAPACITY- See Also:
-
-
Constructor Details
-
FrameStats
-
-
Method Details
-
markStart
-
markEnd
-
getTargetFramerate
public int getTargetFramerate() -
getAverageFramerate
public float getAverageFramerate() -
getFrameUpdateTime
public int getFrameUpdateTime() -
getFrameRenderTime
public int getFrameRenderTime() -
getAverageTimeMS
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
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
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
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
-
resetGraphicsCount
public void resetGraphicsCount() -
getGraphicsCount
public int getGraphicsCount()
-