org.jppf.utils
Class TimeSnapshot

java.lang.Object
  extended by org.jppf.utils.TimeSnapshot
All Implemented Interfaces:
Serializable

public class TimeSnapshot
extends Object
implements Serializable

Convenience class for collecting time statistics.

See Also:
Serialized Form

Field Summary
 String title
          Title for this snapshot, used in the toString() method.
 
Constructor Summary
TimeSnapshot(String title)
          Initialize this time snapshot with a specified title.
 
Method Summary
 double getAvgTime()
          Get the average time.
 long getLatestTime()
          Get the minimum time observed.
 long getMaxTime()
          Get the peak time.
 long getMinTime()
          Get the smallest time observed.
 long getTotalTime()
          Get the total cumulated time.
 TimeSnapshot makeCopy()
          Make a copy of this time snapshot object.
 void newTime(long time, int count, int totalCount)
          Called when a new time has been collected.
 void setAvgTime(double avgTime)
          Set the average time.
 void setLatestTime(long latestTime)
          Set the most recent time observed.
 void setMaxTime(long maxTime)
          Set the peak time.
 void setMinTime(long minTime)
          Set the smallest time observed.
 void setTotalTime(long totalTime)
          Set the total cumulated time.
 String toString()
          Get a string representation of this stats object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

title

public String title
Title for this snapshot, used in the toString() method.

Constructor Detail

TimeSnapshot

public TimeSnapshot(String title)
Initialize this time snapshot with a specified title.

Parameters:
title - the title for this snapshot.
Method Detail

newTime

public void newTime(long time,
                    int count,
                    int totalCount)
Called when a new time has been collected.

Parameters:
time - the new time used to compute the new statistics of this time snapshot.
count - the unit count to which the time applies.
totalCount - the total unit count to which the time applies.

makeCopy

public TimeSnapshot makeCopy()
Make a copy of this time snapshot object.

Returns:
a TimeSnapshot instance.

toString

public String toString()
Get a string representation of this stats object.

Overrides:
toString in class Object
Returns:
a string display the various stats values.
See Also:
Object.toString()

setTotalTime

public void setTotalTime(long totalTime)
Set the total cumulated time.

Parameters:
totalTime - - the total time as a long value.

getTotalTime

public long getTotalTime()
Get the total cumulated time.

Returns:
the total time as a long value.

setLatestTime

public void setLatestTime(long latestTime)
Set the most recent time observed.

Parameters:
latestTime - - the most recent time as a long value.

getLatestTime

public long getLatestTime()
Get the minimum time observed.

Returns:
the minimum time as a long value.

setMinTime

public void setMinTime(long minTime)
Set the smallest time observed.

Parameters:
minTime - - the minimum time as a long value.

getMinTime

public long getMinTime()
Get the smallest time observed.

Returns:
the minimum time as a long value.

setMaxTime

public void setMaxTime(long maxTime)
Set the peak time.

Parameters:
maxTime - - the maximum time as a long value.

getMaxTime

public long getMaxTime()
Get the peak time.

Returns:
the maximum time as a long value.

setAvgTime

public void setAvgTime(double avgTime)
Set the average time.

Parameters:
avgTime - - the average time as a double value.

getAvgTime

public double getAvgTime()
Get the average time.

Returns:
the average time as a double value.


Copyright © 2005-2010 JPPF Team.