org.graphstream.ui.swingViewer.util
Class FpsCounter

java.lang.Object
  extended by org.graphstream.ui.swingViewer.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
FpsCounter()
           
 
Method Summary
 void beginFrame()
          Start a frame measure.
 void endFrame()
          End a frame measure.
 double getAverageFramesPerSecond()
          The average frame-per-second measure.
 double getAverageFrameTimeInSeconds()
          The average frame time.
 int getAverageMeasureCount()
          The number of frames times used to compute the average frame-per-second and frame time.
 double getFramesPerSecond()
          The number of frames per second according to the last measured frame (instantaneous measure).
 double getLastFrameTimeInSeconds()
          The duration in seconds of the last measured frame.
 void resetAverages()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FpsCounter

public FpsCounter()
Method Detail

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.



Copyright © 2012. All Rights Reserved.