public abstract class MonitoredOperation extends Object
| Constructor and Description |
|---|
MonitoredOperation(Counter.Type... types)
Builds a monitored operation with the specified type(s).
|
| Modifier and Type | Method and Description |
|---|---|
Duration |
elapsedTime(Counter.Type type)
Returns the total elapsed time of a specific counter type.
|
double |
elapsedTime(Counter.Type type,
TimeUnit timeUnit)
Returns the total elapsed time of a specific counter type, in the specified time unit.
|
double |
elapsedTime(Counter.Type type,
TimeUnit timeUnit,
ConversionMode conversionMode)
Returns the total elapsed time of a specific counter, in the specified time unit, with
a custom
ConversionMode applied. |
List<Counter> |
getCounters()
Returns all counters available in this monitored operation.
|
List<Counter> |
getCounters(Counter.Type type)
Returns all counters associated with a given type in this monitored operation.
|
void |
printStatistics(PrintStream printStream)
Prints operation statistics in the specified print stream.
|
void |
printStatistics(PrintStream printStream,
TimeUnit timeUnit)
Prints operation statistics in the specified print stream, with a custom time unit.
|
void |
reset()
Cleans all counters available in this monitored operation.
|
public MonitoredOperation(Counter.Type... types)
types - the counter type(s) to be maintained by this operationpublic List<Counter> getCounters()
public List<Counter> getCounters(Counter.Type type)
type - the counter type to be fetchedIllegalArgumentException - if the type was not specified in this operationpublic Duration elapsedTime(Counter.Type type)
type - the counter type to be fetchedIllegalArgumentException - if the type was not specified in this operationpublic double elapsedTime(Counter.Type type, TimeUnit timeUnit)
type - the counter type to be fetchedtimeUnit - the time unit to which the elapsed time will be convertedIllegalArgumentException - if the type was not specified in this operationpublic double elapsedTime(Counter.Type type, TimeUnit timeUnit, ConversionMode conversionMode)
ConversionMode applied.type - the counter type to be fetchedtimeUnit - the time unit to which the elapsed time will be convertedconversionMode - the ConversionMode to be appliedIllegalArgumentException - if the type was not specified in this operationpublic void printStatistics(PrintStream printStream)
printStream - the print stream to which statistics will be sentpublic void printStatistics(PrintStream printStream, TimeUnit timeUnit)
printStream - the print stream to which statistics will be senttimeUnit - the time unit for the elapsed times to be displayedpublic void reset()
Copyright © 2020. All rights reserved.