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 class
Timekeeper.ActiveStopwatch
INTERNAL APIstatic class
Timekeeper.ActiveStopwatch$
INTERNAL APIstatic class
Timekeeper.RemoteActiveStopwatch
INTERNAL APIstatic class
Timekeeper.RemoteStartedStopwatch
INTERNAL APIstatic class
Timekeeper.RemoteStopwatch
INTERNAL APIstatic class
Timekeeper.RemoteSuspendedStopwatch
INTERNAL APIstatic class
Timekeeper.RemoteTimekeeper
static class
Timekeeper.StartedStopwatch
INTERNAL APIstatic class
Timekeeper.StartedStopwatch$
INTERNAL APIstatic class
Timekeeper.Stopwatches
Opaque container for suspended stopwatches that is used to transport them across async boundaries.static class
Timekeeper.Stopwatches$
Opaque container for suspended stopwatches that is used to transport them across async boundaries.static class
Timekeeper.StopwatchTimer
INTERNAL APIstatic class
Timekeeper.StopwatchTimer$
static class
Timekeeper.SuspendedStopwatch
INTERNAL APIstatic class
Timekeeper.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 void
add(java.lang.String name)
void
add(java.lang.String name, long startTime)
void
add(java.lang.String name, long startTime, boolean recordActiveTime)
void
add(java.lang.String name, long startTime, long sampling)
void
add(java.lang.String name, long startTime, long sampling, boolean recordActiveTime)
void
addEmpty(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.StopwatchTimer
get(java.lang.String name, boolean remove)
scala.collection.immutable.Map<java.lang.String,Timekeeper.StopwatchTimer>
getAll()
boolean
isActive(java.lang.String name)
boolean
isEnabled()
Timekeeper.Stopwatches
mergeStopwatches(Timekeeper.Stopwatches first, Timekeeper.Stopwatches second)
INTERNAL APIboolean
recordActiveTime()
Timekeeper.RemoteTimekeeper
remote()
void
remove(java.lang.String name)
void
resumeEmptyStopwatches()
INTERNAL APIvoid
resumeStopwatches(Timekeeper.Stopwatches suspended)
INTERNAL APIvoid
resumeStopwatches(Timekeeper.Stopwatches suspended, long resumeTime)
INTERNAL APIlong
startTime(java.lang.String name, boolean remove)
void
stop(java.lang.String name)
Stop an active stopwatch with the specified name creating a user defined time interval.void
stop(java.lang.String name, long stopTime)
protected abstract void
stopped(java.lang.String name, long elapsed, long active)
INTERNAL APIprotected void
stopped(java.lang.String name, Timekeeper.StopwatchTimer stopwatch, long stopTime)
INTERNAL APITimekeeper.Stopwatches
suspendStopwatches()
INTERNAL APITimekeeper.Stopwatches
suspendStopwatches(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:
add
in 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:Stopwatch
Stop 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:
remove
in 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
-
-