org.javasimon
Class StopwatchSample

java.lang.Object
  extended by org.javasimon.Sample
      extended by org.javasimon.StopwatchSample
Direct Known Subclasses:
StopwatchSample

public class StopwatchSample
extends Sample

Object holds all relevant data from Stopwatch Simon. Whenever it is important to get more values in a synchronous manner, Stopwatch.sample() (or Stopwatch.sampleAndReset() should be used to obtain this Java Bean object.

Author:
Richard "Virgo" Richter

Field Summary
private  long active
           
private  long counter
           
private  long last
           
private  long max
           
private  long maxActive
           
private  long maxActiveTimestamp
           
private  long maxTimestamp
           
private  double mean
           
private  long min
           
private  long minTimestamp
           
private  double standardDeviation
           
private  long total
           
private  double variance
           
private  double varianceN
           
 
Constructor Summary
StopwatchSample()
           
 
Method Summary
 long getActive()
          Returns current number of measured splits (concurrently running).
 long getCounter()
          Returns usage count of the stopwatch.
 long getLast()
          Returns the value of the last measured split in ns.
 long getMax()
          Returns maximal time split value in nanoseconds.
 long getMaxActive()
          Returns peek value of active concurrent splits.
 long getMaxActiveTimestamp()
          Returns ms timestamp when the last peek of the active split count occured.
 long getMaxTimestamp()
          Returns ms timestamp when the max value was measured.
 double getMean()
          Returns mean value (average) of all measured values.
 long getMin()
          Returns minimal time split value in nanoseconds.
 long getMinTimestamp()
          Returns ms timestamp when the min value was measured.
 double getStandardDeviation()
          Returns standard deviation for all measured values.
 long getTotal()
          Returns the total sum of all split times in nanoseconds.
 double getVariance()
          Returns unbiased estimate of the population variance.
 double getVarianceN()
          Returns variance value of all measured values (entire population).
 void setActive(long active)
          Sets the current number of measured splits (concurrently running).
 void setCounter(long counter)
          Sets the usage count of the stopwatch.
 void setLast(long last)
          Sets the value of the last measured split in ns.
 void setMax(long max)
          Sets the maximal time split value in nanoseconds.
 void setMaxActive(long maxActive)
          Sets the peek value of active concurrent splits.
 void setMaxActiveTimestamp(long maxActiveTimestamp)
          Sets the ms timestamp when the last peek of the active split count occured.
 void setMaxTimestamp(long maxTimestamp)
          Sets the ms timestamp when the max value was measured.
 void setMean(double mean)
          Sets the mean value (average) of all measured values.
 void setMin(long min)
          Sets the minimal time split value in nanoseconds.
 void setMinTimestamp(long minTimestamp)
          Sets the ms timestamp when the min value was measured.
 void setStandardDeviation(double standardDeviation)
          Sets the standard deviation for all measured values.
 void setTotal(long total)
          Sets the total sum of all split times in nanoseconds.
 void setVariance(double variance)
          Sets the unbiased estimate of the population variance.
 void setVarianceN(double varianceN)
          Sets the variance value of all measured values (entire population).
 String stopwatchToString()
          Equivalent to StopwatchImpl.toString() without state.
 String toString()
          Returns readable representation of object.
 
Methods inherited from class org.javasimon.Sample
finishWithUsagesAndNote, getFirstUsage, getLastReset, getLastUsage, getName, getNote, setFirstUsage, setLastReset, setLastUsage, setName, setNote, simonToString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

total

private long total

counter

private long counter

min

private long min

max

private long max

minTimestamp

private long minTimestamp

maxTimestamp

private long maxTimestamp

active

private long active

maxActive

private long maxActive

maxActiveTimestamp

private long maxActiveTimestamp

last

private long last

mean

private double mean

standardDeviation

private double standardDeviation

variance

private double variance

varianceN

private double varianceN
Constructor Detail

StopwatchSample

public StopwatchSample()
Method Detail

getTotal

public final long getTotal()
Returns the total sum of all split times in nanoseconds.

Returns:
total time of the stopwatch in nanoseconds

setTotal

public final void setTotal(long total)
Sets the total sum of all split times in nanoseconds.

Parameters:
total - total time of the stopwatch in nanoseconds

getCounter

public final long getCounter()
Returns usage count of the stopwatch. Counter is increased by addTime and stop - that means that it's updated every time the next time split is added.

Returns:
count of time splits

setCounter

public final void setCounter(long counter)
Sets the usage count of the stopwatch.

Parameters:
counter - count of time splits

getMin

public final long getMin()
Returns minimal time split value in nanoseconds.

Returns:
minimal time split in nanoseconds

setMin

public final void setMin(long min)
Sets the minimal time split value in nanoseconds.

Parameters:
min - minimal time split in nanoseconds

getMax

public final long getMax()
Returns maximal time split value in nanoseconds.

Returns:
maximal time split in nanoseconds

setMax

public final void setMax(long max)
Sets the maximal time split value in nanoseconds.

Parameters:
max - maximal time split in nanoseconds

getMinTimestamp

public final long getMinTimestamp()
Returns ms timestamp when the min value was measured.

Returns:
ms timestamp of the min value measurement

setMinTimestamp

public final void setMinTimestamp(long minTimestamp)
Sets the ms timestamp when the min value was measured.

Parameters:
minTimestamp - ms timestamp of the min value measurement

getMaxTimestamp

public final long getMaxTimestamp()
Returns ms timestamp when the max value was measured.

Returns:
ms timestamp of the max value measurement

setMaxTimestamp

public final void setMaxTimestamp(long maxTimestamp)
Sets the ms timestamp when the max value was measured.

Parameters:
maxTimestamp - ms timestamp of the max value measurement

getActive

public final long getActive()
Returns current number of measured splits (concurrently running).

Returns:
current number of active splits

setActive

public final void setActive(long active)
Sets the current number of measured splits (concurrently running).

Parameters:
active - current number of active splits

getMaxActive

public final long getMaxActive()
Returns peek value of active concurrent splits.

Returns:
maximum reached value of active splits

setMaxActive

public final void setMaxActive(long maxActive)
Sets the peek value of active concurrent splits.

Parameters:
maxActive - maximum reached value of active splits

getMaxActiveTimestamp

public final long getMaxActiveTimestamp()
Returns ms timestamp when the last peek of the active split count occured.

Returns:
ms timestamp of the last peek of the active split count

setMaxActiveTimestamp

public final void setMaxActiveTimestamp(long maxActiveTimestamp)
Sets the ms timestamp when the last peek of the active split count occured.

Parameters:
maxActiveTimestamp - ms timestamp of the last peek of the active split count

getLast

public final long getLast()
Returns the value of the last measured split in ns.

Returns:
last measured split in ns

setLast

public final void setLast(long last)
Sets the value of the last measured split in ns.

Parameters:
last - last measured split in ns

getMean

public final double getMean()
Returns mean value (average) of all measured values.

Returns:
mean value

setMean

public final void setMean(double mean)
Sets the mean value (average) of all measured values.

Parameters:
mean - mean value

getStandardDeviation

public final double getStandardDeviation()
Returns standard deviation for all measured values.

Returns:
standard deviation

setStandardDeviation

public final void setStandardDeviation(double standardDeviation)
Sets the standard deviation for all measured values.

Parameters:
standardDeviation - standard deviation

getVariance

public final double getVariance()
Returns unbiased estimate of the population variance.

Returns:
unbiased estimated variance

setVariance

public final void setVariance(double variance)
Sets the unbiased estimate of the population variance.

Parameters:
variance - unbiased estimated variance

getVarianceN

public final double getVarianceN()
Returns variance value of all measured values (entire population).

Returns:
entire population variance

setVarianceN

public final void setVarianceN(double varianceN)
Sets the variance value of all measured values (entire population).

Parameters:
varianceN - entire population variance

toString

public String toString()
Returns readable representation of object.

Overrides:
toString in class Object
Returns:
string with readable representation of object

stopwatchToString

public String stopwatchToString()
Equivalent to StopwatchImpl.toString() without state.



Copyright © 2013. All Rights Reserved.