org.xith3d.utility.timing
Class PerformanceStats

java.lang.Object
  extended by org.xith3d.utility.timing.PerformanceStats
All Implemented Interfaces:
Updatable

public class PerformanceStats
extends java.lang.Object
implements Updatable

Displays each second on the command line the number of milliseconds spent for a frame and the number of frames per second.


Constructor Summary
PerformanceStats()
          Create a new PerformanceStats with printing enabled by default
PerformanceStats(boolean printingEnabled)
          Create a new PerformanceStats with printing enabled/disabled
 
Method Summary
 float getFPS()
           
 long getMPF()
           
 boolean isPrintingEnabled()
           
 void print()
          Print stats
 void setPrintingEnabled(boolean printingEnabled)
           
 void update(long gameTime, long frameTime, UpdatingThread.TimingMode timingMode)
          Updates this Updatable object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PerformanceStats

public PerformanceStats()
Create a new PerformanceStats with printing enabled by default


PerformanceStats

public PerformanceStats(boolean printingEnabled)
Create a new PerformanceStats with printing enabled/disabled

Parameters:
printingEnabled - If true, prints some stats on the command line each second
Method Detail

update

public void update(long gameTime,
                   long frameTime,
                   UpdatingThread.TimingMode timingMode)
Description copied from interface: Updatable
Updates this Updatable object.

Specified by:
update in interface Updatable
Parameters:
gameTime - the gameTime in Milliseconds
frameTime - the frameTime in Milliseconds (needed time for the last frame)
timingMode - the TimingMode to use for frameTime.

getFPS

public float getFPS()
Returns:
the count of Frames per second (value updated each second)

getMPF

public long getMPF()
Returns:
the count of Millis per frame (value updated each second)

isPrintingEnabled

public boolean isPrintingEnabled()
Returns:
if automatic stat printing is enabled

setPrintingEnabled

public void setPrintingEnabled(boolean printingEnabled)
Parameters:
printingEnabled - set on/off automatic stat printing

print

public void print()
Print stats