de.grogra.imp3d.glsl
Class Measures

java.lang.Object
  extended by de.grogra.imp3d.glsl.Measures

public class Measures
extends java.lang.Object

Measures is a utility that may store and retrieve time measures for ViewComponentAdapter.repaint(int) and GLSLDisplay.render(int). This class is a singleton and will only produce correct results if not more than one Display-Window is open. The methods may be called within the XL-Console.

Author:
Konni Hartmann

Method Summary
static Measures getInstance()
           
 void printRPSummary()
          Print a summary of collected renderpass time.
 void printSummary()
          Print a summary of collected render times.
 void restartNow()
          This will reset the measurement.
 void saveTimeDiffSummary()
          Store the rendertimes obtained from the used Display class to a csv-File in the current working directory.
 void setCounter(int counter)
           
 void setCurrentFileName(java.lang.String s)
          Sets the name for a file into which measures may be saved.
 void setData(int all, int rend)
           
 void setRedraw(boolean redraw)
          Changes behavior of measuring method.
 void setRPTimeDiff(int rpID, long value)
          Stores the time used to process a renderpass.
 boolean shouldRedraw()
          Check if scene should be redrawn.
 void startTimer()
           
 void stopTimer(RenderState rs)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static Measures getInstance()
Returns:
An instance of this class. Since this class is a singleton the same reference will be returned for all calls of this method.

printRPSummary

public void printRPSummary()
Print a summary of collected renderpass time.


printSummary

public void printSummary()
Print a summary of collected render times.


restartNow

public void restartNow()
This will reset the measurement.


saveTimeDiffSummary

public void saveTimeDiffSummary()
Store the rendertimes obtained from the used Display class to a csv-File in the current working directory. The name is specified by the method setCurrentFileName(String).


setCounter

public void setCounter(int counter)

setCurrentFileName

public void setCurrentFileName(java.lang.String s)
Sets the name for a file into which measures may be saved. This will be used as a filename only. No directory or ending should be added.

Parameters:
s - The filename.

setData

public void setData(int all,
                    int rend)

setRedraw

public void setRedraw(boolean redraw)
Changes behavior of measuring method.

Parameters:
redraw - If set to true, the scene will be redrawn after each call of the render method resulting in continuous drawing.

setRPTimeDiff

public void setRPTimeDiff(int rpID,
                          long value)
Stores the time used to process a renderpass.

Parameters:
rpID - The ID of the renderpass. Renderpasses are arbitrarily categorized into groups ranging from 0 to 6.
value - The time to be stored.

shouldRedraw

public boolean shouldRedraw()
Check if scene should be redrawn. This is used by the Displays render-method to test if it should issue the (protected) ViewComponent.repaint(int) method.

Returns:
true if scene should be redrawn.

startTimer

public void startTimer()

stopTimer

public void stopTimer(RenderState rs)