com.flexive.shared
Class TimestampRecorder

java.lang.Object
  extended by com.flexive.shared.TimestampRecorder
All Implemented Interfaces:
java.io.Serializable

public class TimestampRecorder
extends java.lang.Object
implements java.io.Serializable

An utility class to record timestamps during execution of a method and print (debugging) benchmark information.

Since:
3.1
Version:
$Rev$
Author:
Daniel Lichtenberger (daniel.lichtenberger@flexive.com), UCS - unique computing solutions gmbh (http://www.ucs.at)
See Also:
Serialized Form

Constructor Summary
TimestampRecorder()
           
 
Method Summary
 void begin()
          Resets the timer to begin recording.
 java.util.List<Pair<java.lang.String,java.lang.Long>> getTimestamps()
          Returns the list of timestamps in nanosecond precision.
 long timestamp(java.lang.String name)
          Add a timestamp with the given name.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TimestampRecorder

public TimestampRecorder()
Method Detail

begin

public void begin()
Resets the timer to begin recording.


timestamp

public long timestamp(java.lang.String name)
Add a timestamp with the given name. The execution time of atimestamp is the time elapsed since the last call to timestamp or begin, if no timestamp was recorded yet.

Parameters:
name - Timestamp name which will be included in the string representation
Returns:
the time taken for the last task, in nanoseconds

getTimestamps

public java.util.List<Pair<java.lang.String,java.lang.Long>> getTimestamps()
Returns the list of timestamps in nanosecond precision.

Returns:
the list of timestamps in nanosecond precision.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object