org.perf4j
Class GroupedTimingStatistics

java.lang.Object
  extended by org.perf4j.GroupedTimingStatistics
All Implemented Interfaces:
Serializable, Cloneable

public class GroupedTimingStatistics
extends Object
implements Serializable, Cloneable

Represents a set of TimingStatistics calculated for a specific time period for a set of tags.

Author:
Alex Devine
See Also:
Serialized Form

Constructor Summary
GroupedTimingStatistics()
          Default constructor allows you to set statistics later using the addStopWatch and setter methods.
GroupedTimingStatistics(SortedMap<String,TimingStatistics> statisticsByTag, long startTime, long stopTime, boolean createRollupStatistics)
          Creates a GroupedTimingStatistics instance for a set of tags for a specified time span.
 
Method Summary
 GroupedTimingStatistics addStopWatch(StopWatch stopWatch)
          This method updates the calculated statistics when a new logged StopWatch is added.
 GroupedTimingStatistics addStopWatches(Collection<StopWatch> stopWatches)
          Updates these statistics with all of the StopWatches in the specified collection.
 GroupedTimingStatistics clone()
           
 boolean equals(Object o)
           
 long getStartTime()
           
 SortedMap<String,TimingStatistics> getStatisticsByTag()
           
 long getStopTime()
           
 int hashCode()
           
 boolean isCreateRollupStatistics()
           
 void setCreateRollupStatistics(boolean createRollupStatistics)
           
 void setStartTime(long startTime)
           
 void setStatisticsByTag(SortedMap<String,TimingStatistics> statisticsByTag)
           
 void setStopTime(long stopTime)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GroupedTimingStatistics

public GroupedTimingStatistics()
Default constructor allows you to set statistics later using the addStopWatch and setter methods.


GroupedTimingStatistics

public GroupedTimingStatistics(SortedMap<String,TimingStatistics> statisticsByTag,
                               long startTime,
                               long stopTime,
                               boolean createRollupStatistics)
Creates a GroupedTimingStatistics instance for a set of tags for a specified time span.

Parameters:
statisticsByTag - This Map maps String tag times to the aggregated TimingStatistics for that tag.
startTime - The start time (as reported by System.currentTimeMillis()) of the time span for which the statistics apply.
stopTime - The end time of the time span for which the statistics apply.
createRollupStatistics - Whether or not the statisticsByTag contains "rollup statistics". Rollup statistics allow users to time different execution paths of the same code block. For example, when timing a code block, one may which to log execution time with a "codeBlock.success" tag when execution completes normally and a "codeBlock.failure" tag when an exception is thrown. If rollup statistics are used, then in addition to the codeBlock.success and codeBlock.failure tags, a codeBlock tag is created that represents StopWatch logs from EITHER the success or failure tags.
Method Detail

addStopWatch

public GroupedTimingStatistics addStopWatch(StopWatch stopWatch)
This method updates the calculated statistics when a new logged StopWatch is added.

Parameters:
stopWatch - The StopWatch being used to update the statistics.
Returns:
this GroupedTimingStatistics instance

addStopWatches

public GroupedTimingStatistics addStopWatches(Collection<StopWatch> stopWatches)
Updates these statistics with all of the StopWatches in the specified collection.

Parameters:
stopWatches - The collection of StopWatches to add to this GroupedTimingStatistics data set.
Returns:
this GroupedTimingStatistics instance

getStatisticsByTag

public SortedMap<String,TimingStatistics> getStatisticsByTag()

setStatisticsByTag

public void setStatisticsByTag(SortedMap<String,TimingStatistics> statisticsByTag)

getStartTime

public long getStartTime()

setStartTime

public void setStartTime(long startTime)

getStopTime

public long getStopTime()

setStopTime

public void setStopTime(long stopTime)

isCreateRollupStatistics

public boolean isCreateRollupStatistics()

setCreateRollupStatistics

public void setCreateRollupStatistics(boolean createRollupStatistics)

toString

public String toString()
Overrides:
toString in class Object

clone

public GroupedTimingStatistics clone()
Overrides:
clone in class Object

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2008-2009 perf4j.org. All Rights Reserved.