Interface Timer
- All Superinterfaces:
Meter
Represents a timer.
- Author:
- Holger Eichelberger, SSE
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classDefault implementation ofTimer.Samplebased on micrometer.static interfaceMaintains state on the clock's start position for a latency sample.static interfaceBuilds a timer.Nested classes/interfaces inherited from interface de.iip_ecosphere.platform.support.metrics.Meter
Meter.Id, Meter.Type -
Method Summary
Modifier and TypeMethodDescriptionReturns the base time unit.longcount()Returns the number of times that stop has been called on this timer.doubleReturns the maximum time of a single event.doubleReturns the mean/average for all recorded events.voidUpdates the statistics kept by the timer with the specified amount.voidExecutes the runnablefuncand records the time taken.<T> TExecutes the Suppliersupplierand records the time taken.<T> TrecordCallable(Callable<T> function) Executes the callablefunctionand records the time taken.doubleReturns the total time of recorded events.
-
Method Details
-
record
Executes the runnablefuncand records the time taken.- Parameters:
func- function to execute and measure the execution time
-
record
Updates the statistics kept by the timer with the specified amount.- Parameters:
amount- Duration of a single event being measured by this timer. If the amount is less than 0 the value will be droppedunit- Time unit for the amount being recorded
-
record
Executes the Suppliersupplierand records the time taken.- Type Parameters:
T- The return type of thesupplier.- Parameters:
supplier- Function to execute and measure the execution time.- Returns:
- The return value of
supplier.
-
recordCallable
Executes the callablefunctionand records the time taken. -
count
long count()Returns the number of times that stop has been called on this timer.- Returns:
- the number of times
-
baseTimeUnit
TimeUnit baseTimeUnit()Returns the base time unit.- Returns:
- the base time unit of the timer to which all published metrics will be scaled
-
max
Returns the maximum time of a single event.- Parameters:
unit- The base unit of time to scale the max to- Returns:
- The maximum time of a single event
-
totalTime
Returns the total time of recorded events.- Parameters:
unit- The base unit of time to scale the total to- Returns:
- The total time of recorded events
-
mean
Returns the mean/average for all recorded events.- Parameters:
unit- The base unit of time to scale the mean to- Returns:
- the distribution average for all recorded events
-