Package com.lightbend.cinnamon.stopwatch
Class Timekeeper
- java.lang.Object
-
- com.lightbend.cinnamon.stopwatch.StopwatchBlocks
-
- com.lightbend.cinnamon.stopwatch.Timekeeper
-
- All Implemented Interfaces:
Stopwatch
- Direct Known Subclasses:
Stopwatch.DefaultTimekeeper
public abstract class Timekeeper extends StopwatchBlocks
Default implementation of a Stopwatch. Subclasses need to extend this to transport the stopwatches across async boundaries and get notified when a stopwatch is stopped.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTimekeeper.ActiveStopwatchINTERNAL APIstatic classTimekeeper.ActiveStopwatch$INTERNAL APIstatic classTimekeeper.RemoteActiveStopwatchINTERNAL APIstatic classTimekeeper.RemoteStartedStopwatchINTERNAL APIstatic classTimekeeper.RemoteStopwatchINTERNAL APIstatic classTimekeeper.RemoteSuspendedStopwatchINTERNAL APIstatic classTimekeeper.RemoteTimekeeperstatic classTimekeeper.StartedStopwatchINTERNAL APIstatic classTimekeeper.StartedStopwatch$INTERNAL APIstatic classTimekeeper.StopwatchesOpaque container for suspended stopwatches that is used to transport them across async boundaries.static classTimekeeper.Stopwatches$Opaque container for suspended stopwatches that is used to transport them across async boundaries.static classTimekeeper.StopwatchTimerINTERNAL APIstatic classTimekeeper.StopwatchTimer$static classTimekeeper.SuspendedStopwatchINTERNAL APIstatic classTimekeeper.SuspendedStopwatch$INTERNAL API
-
Constructor Summary
Constructors Constructor Description Timekeeper(boolean recordActiveTime, boolean isEnabled)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidadd(java.lang.String name)voidadd(java.lang.String name, long startTime)voidadd(java.lang.String name, long startTime, boolean recordActiveTime)voidadd(java.lang.String name, long startTime, long sampling)voidadd(java.lang.String name, long startTime, long sampling, boolean recordActiveTime)voidaddEmpty(java.lang.String name)protected scala.collection.immutable.Map<java.lang.String,Timekeeper.StopwatchTimer>data()static scala.collection.immutable.Map<java.lang.String,Timekeeper.StopwatchTimer>empty()Timekeeper.StopwatchTimerget(java.lang.String name, boolean remove)scala.collection.immutable.Map<java.lang.String,Timekeeper.StopwatchTimer>getAll()booleanisActive(java.lang.String name)booleanisEnabled()Timekeeper.StopwatchesmergeStopwatches(Timekeeper.Stopwatches first, Timekeeper.Stopwatches second)INTERNAL APIbooleanrecordActiveTime()Timekeeper.RemoteTimekeeperremote()voidremove(java.lang.String name)voidresumeEmptyStopwatches()INTERNAL APIvoidresumeStopwatches(Timekeeper.Stopwatches suspended)INTERNAL APIvoidresumeStopwatches(Timekeeper.Stopwatches suspended, long resumeTime)INTERNAL APIlongstartTime(java.lang.String name, boolean remove)voidstop(java.lang.String name)Stop an active stopwatch with the specified name creating a user defined time interval.voidstop(java.lang.String name, long stopTime)protected abstract voidstopped(java.lang.String name, long elapsed, long active)INTERNAL APIprotected voidstopped(java.lang.String name, Timekeeper.StopwatchTimer stopwatch, long stopTime)INTERNAL APITimekeeper.StopwatchessuspendStopwatches()INTERNAL APITimekeeper.StopwatchessuspendStopwatches(long suspendTime)INTERNAL API
-
-
-
Method Detail
-
empty
public static scala.collection.immutable.Map<java.lang.String,Timekeeper.StopwatchTimer> empty()
-
recordActiveTime
public boolean recordActiveTime()
-
isEnabled
public boolean isEnabled()
-
remote
public Timekeeper.RemoteTimekeeper remote()
-
data
protected final scala.collection.immutable.Map<java.lang.String,Timekeeper.StopwatchTimer> data()
-
add
public void add(java.lang.String name)
- Specified by:
addin classStopwatchBlocks
-
add
public void add(java.lang.String name, long startTime)
-
add
public void add(java.lang.String name, long startTime, long sampling)
-
add
public void add(java.lang.String name, long startTime, boolean recordActiveTime)
-
add
public void add(java.lang.String name, long startTime, long sampling, boolean recordActiveTime)
-
addEmpty
public void addEmpty(java.lang.String name)
-
isActive
public boolean isActive(java.lang.String name)
-
getAll
public scala.collection.immutable.Map<java.lang.String,Timekeeper.StopwatchTimer> getAll()
-
get
public Timekeeper.StopwatchTimer get(java.lang.String name, boolean remove)
-
startTime
public long startTime(java.lang.String name, boolean remove)
-
stop
public void stop(java.lang.String name)
Description copied from interface:StopwatchStop an active stopwatch with the specified name creating a user defined time interval. A user defined stopwatch may start and stop in any location in the asynchronous flow, i.e. it may span over several actors, futures, or streams.- Parameters:
name- name of the stopwatch to stop
-
stop
public void stop(java.lang.String name, long stopTime)
-
remove
public void remove(java.lang.String name)
- Specified by:
removein classStopwatchBlocks
-
suspendStopwatches
public Timekeeper.Stopwatches suspendStopwatches()
INTERNAL APISuspend the active stopwatches to transport them across an async boundary.
- Returns:
- (undocumented)
-
suspendStopwatches
public Timekeeper.Stopwatches suspendStopwatches(long suspendTime)
INTERNAL APISuspend the active stopwatches to transport them across an async boundary.
- Parameters:
suspendTime- (undocumented)- Returns:
- (undocumented)
-
resumeStopwatches
public void resumeStopwatches(Timekeeper.Stopwatches suspended)
INTERNAL APIResume suspended stopwatches after an async boundary jump.
- Parameters:
suspended- (undocumented)
-
resumeStopwatches
public void resumeStopwatches(Timekeeper.Stopwatches suspended, long resumeTime)
INTERNAL APIResume suspended stopwatches after an async boundary jump.
- Parameters:
suspended- (undocumented)resumeTime- (undocumented)
-
resumeEmptyStopwatches
public void resumeEmptyStopwatches()
INTERNAL APIResume empty stopwatches after an async boundary jump.
-
mergeStopwatches
public Timekeeper.Stopwatches mergeStopwatches(Timekeeper.Stopwatches first, Timekeeper.Stopwatches second)
INTERNAL APIMerge suspended stopwatches for context joining.
- Parameters:
first- (undocumented)second- (undocumented)- Returns:
- (undocumented)
-
stopped
protected void stopped(java.lang.String name, Timekeeper.StopwatchTimer stopwatch, long stopTime)INTERNAL APIA stopwatch stopped.
- Parameters:
name- (undocumented)stopwatch- (undocumented)stopTime- (undocumented)
-
stopped
protected abstract void stopped(java.lang.String name, long elapsed, long active)INTERNAL APIA stopwatch stopped.
- Parameters:
name- the name of the stopwatchelapsed- the recorded time for this stopwatch in nanosecondsactive- the recorded active time for this stopwatch in nanoseconds
-
-