org.javasimon.callback.timeline
Class StopwatchTimeline

java.lang.Object
  extended by org.javasimon.callback.timeline.Timeline<StopwatchTimeRange>
      extended by org.javasimon.callback.timeline.StopwatchTimeline

public final class StopwatchTimeline
extends Timeline<StopwatchTimeRange>

Timeline for Stopwatches, historicise Stopwatch state on a rolling period of time.

Author:
gerald

Field Summary
 
Fields inherited from class org.javasimon.callback.timeline.Timeline
timeRanges, timeRangeWidth
 
Constructor Summary
StopwatchTimeline(int capacity, long timeRangeWidth)
          Main constructor
 
Method Summary
 void addSplit(Split split)
          Main method used to insert the split on the timeline: Split start is used to determine in which timerange it should be split.
protected  StopwatchTimeRange createTimeRange(long startTimestamp, long endTimestamp)
          Produces a StopwatchTimeRange object
 TimelineSample<StopwatchTimeRange> sample()
          Take a snapshot of the timeline.
 
Methods inherited from class org.javasimon.callback.timeline.Timeline
getOrCreateTimeRange
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StopwatchTimeline

public StopwatchTimeline(int capacity,
                         long timeRangeWidth)
Main constructor

Parameters:
capacity - Number of time range.
timeRangeWidth - Width of each time range
Method Detail

createTimeRange

protected StopwatchTimeRange createTimeRange(long startTimestamp,
                                             long endTimestamp)
Produces a StopwatchTimeRange object

Specified by:
createTimeRange in class Timeline<StopwatchTimeRange>
Parameters:
startTimestamp - Range beginning
endTimestamp - Range ending
Returns:
StopwatchTimeRange object

addSplit

public void addSplit(Split split)
Main method used to insert the split on the timeline:
  1. Split start is used to determine in which timerange it should be split. A new time range may be created if needed.
  2. Split duration is added to time range statistics.
The split might be drop if it's too old.

Parameters:
split - Split

sample

public TimelineSample<StopwatchTimeRange> sample()
Take a snapshot of the timeline.

Specified by:
sample in class Timeline<StopwatchTimeRange>
Returns:
Timeline sample


Copyright © 2013. All Rights Reserved.