Package org.graphstream.ui.view.util
Class FpsCounter
java.lang.Object
org.graphstream.ui.view.util.FpsCounter
public class FpsCounter extends Object
A simple counter that allows to count the number of frames per second.
- Author:
- Antoine Dutot
-
Constructor Summary
Constructors Constructor Description FpsCounter() -
Method Summary
Modifier and Type Method Description voidbeginFrame()Start a frame measure.voidendFrame()End a frame measure.doublegetAverageFramesPerSecond()The average frame-per-second measure.doublegetAverageFrameTimeInSeconds()The average frame time.intgetAverageMeasureCount()The number of frames times used to compute the average frame-per-second and frame time.doublegetFramesPerSecond()The number of frames per second according to the last measured frame (instantaneous measure).doublegetLastFrameTimeInSeconds()The duration in seconds of the last measured frame.voidresetAverages()
-
Constructor Details
-
FpsCounter
public FpsCounter()
-
-
Method Details
-
getFramesPerSecond
public double getFramesPerSecond()The number of frames per second according to the last measured frame (instantaneous measure).- Returns:
- The estimated frame-per-second measure of the last frame.
-
getLastFrameTimeInSeconds
public double getLastFrameTimeInSeconds()The duration in seconds of the last measured frame.- Returns:
- The last frame time in seconds.
-
getAverageMeasureCount
public int getAverageMeasureCount()The number of frames times used to compute the average frame-per-second and frame time. This number augments with the measures until a maximum, where it is reset to 0.- Returns:
- The number of frames measure.
-
getAverageFramesPerSecond
public double getAverageFramesPerSecond()The average frame-per-second measure.- Returns:
- The average number of frames per second.
- See Also:
getAverageMeasureCount()
-
getAverageFrameTimeInSeconds
public double getAverageFrameTimeInSeconds()The average frame time.- Returns:
- The time used by a frame in average.
-
resetAverages
public void resetAverages() -
beginFrame
public void beginFrame()Start a frame measure. -
endFrame
public void endFrame()End a frame measure.
-