Package com.lightbend.cinnamon.stopwatch
Interface Stopwatch
-
- All Known Subinterfaces:
StopwatchExtension
- All Known Implementing Classes:
Stopwatch.DefaultTimekeeper
,StopwatchBlocks
,Timekeeper
public interface Stopwatch
User API for demarcating a stopwatch time interval.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
activate(java.lang.String name)
Start a stopwatch where subsequent operations in the current asynchronous scope will propagate the stopwatch; such as within the scope of an Akka Stream operator.void
start(java.lang.String name, java.lang.Runnable runnable)
Start a stopwatch where the operations in the runnable will propagate the stopwatch.<T> T
start(java.lang.String name, scala.Function0<T> block)
Start a stopwatch where the operations in the block will propagate the stopwatch.void
stop(java.lang.String name)
Stop an active stopwatch with the specified name creating a user defined time interval.void
wrap(java.lang.String name, java.lang.Runnable runnable)
Run the runnable within a stopwatch start and end, to create a user defined time interval.<T> T
wrap(java.lang.String name, scala.Function0<T> block)
Run the block within a stopwatch start and stop, to create a user defined time interval.
-
-
-
Method Detail
-
wrap
<T> T wrap(java.lang.String name, scala.Function0<T> block)
Run the block within a stopwatch start and stop, to create a user defined time interval.- Type Parameters:
T
- return type of block- Parameters:
name
- name of the stopwatchblock
- block of code to run within the time interval- Returns:
- result of block
-
wrap
void wrap(java.lang.String name, java.lang.Runnable runnable)
Run the runnable within a stopwatch start and end, to create a user defined time interval.- Parameters:
name
- name of the stopwatchrunnable
- runnable to run within the time interval
-
start
<T> T start(java.lang.String name, scala.Function0<T> block)
Start a stopwatch where the operations in the block will propagate the stopwatch. The matching stopwatch stop operation will create 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.- Type Parameters:
T
- return type of block- Parameters:
name
- name of the stopwatchblock
- block of code to run within the stopwatch start scope- Returns:
- result of block
-
start
void start(java.lang.String name, java.lang.Runnable runnable)
Start a stopwatch where the operations in the runnable will propagate the stopwatch. The matching stopwatch stop operation will create 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 stopwatchrunnable
- runnable to run within the stopwatch start scope
-
activate
void activate(java.lang.String name)
Start a stopwatch where subsequent operations in the current asynchronous scope will propagate the stopwatch; such as within the scope of an Akka Stream operator. The matching stopwatch stop operation will create 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
-
stop
void stop(java.lang.String name)
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
-
-