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. |
Map<Counter.Type,List<Counter>> |
getAllCountersByType()
Returns a map of populated counters grouped by type, where each entry in the counters
list represents a timing session.
|
List<Counter> |
getCounters(Counter.Type type)
Returns all counters associated with a given type in this monitored operation.
|
void |
printDetails(PrintStream printStream)
Prints detailed information about timing sessions in the specified print stream.
|
void |
printDetails(PrintStream printStream,
PrintStyle printStyle)
Prints detailed information about timing sessions in the specified print stream, with a
custom
PrintStyle. |
void |
printSummary(PrintStream printStream)
Prints summarized elapsed times in the specified print stream.
|
void |
printSummary(PrintStream printStream,
PrintStyle printStyle)
Prints summarized elapsed times in the specified print stream, with a custom
PrintStyle. |
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(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 printSummary(PrintStream printStream)
printStream - the print stream to which data will be sentpublic void printSummary(PrintStream printStream, PrintStyle printStyle)
PrintStyle.printStream - the print stream to which data will be sentprintStyle - the PrintStyle to be appliedpublic void printDetails(PrintStream printStream)
printStream - the print stream to which information will be sentpublic void printDetails(PrintStream printStream, PrintStyle printStyle)
PrintStyle.printStream - the print stream to which information will be sentprintStyle - the PrintStyle to be appliedpublic Map<Counter.Type,List<Counter>> getAllCountersByType()
public void reset()
Copyright © 2021. All rights reserved.