public abstract class MonitoredOperation extends Object
| Modifier and Type | Method and Description |
|---|---|
Duration |
elapsedTime()
Returns the total elapsed time for a single counter type, provided that this monitor is
keeping a single type.
|
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. |
double |
elapsedTime(TimeUnit timeUnit)
Returns the total elapsed time in the specified time unit for a single counter type,
provided that this monitor is keeping a single type.
|
double |
elapsedTime(TimeUnit timeUnit,
ConversionMode conversionMode)
Returns the total elapsed time in the specified time unit for a single counter type,
provided that this monitor is keeping a single type.
|
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.
|
String |
toString()
Returns a string containing a formatted monitor summary.
|
public List<Counter> getCounters(Counter.Type type)
type - the counter type to be fetchedIllegalArgumentException - if the specified type was not assigned to the
operation during instantiationpublic Duration elapsedTime()
IllegalStateException - if this monitor is keeping more than one counter typepublic double elapsedTime(TimeUnit timeUnit)
timeUnit - the time unit to which the elapsed time will be convertedIllegalStateException - if this monitor is keeping more than one counter typepublic double elapsedTime(TimeUnit timeUnit, ConversionMode conversionMode)
timeUnit - the time unit to which the elapsed time will be convertedconversionMode - the ConversionMode to be appliedIllegalStateException - if this monitor is keeping more than one counter typepublic Duration elapsedTime(Counter.Type type)
type - the counter type to be fetchedIllegalArgumentException - if the specified type was not assigned to the
operation during instantiationpublic 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 specified type was not assigned to the
operation during instantiationpublic 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 specified type was not assigned to the
operation during instantiationpublic void printSummary(PrintStream printStream)
printStream - the print stream to which data will be sentNullPointerException - if the PrintStream is nullpublic void printSummary(PrintStream printStream, PrintStyle printStyle)
PrintStyle.printStream - the print stream to which data will be sentprintStyle - the PrintStyle to be appliedNullPointerException - if the PrintStream is nullIllegalArgumentException - if the specified PrintStyle is not compatible with
PrintFormat.SUMMARIZEDpublic void printDetails(PrintStream printStream)
printStream - the print stream to which information will be sentNullPointerException - if the PrintStream is nullpublic void printDetails(PrintStream printStream, PrintStyle printStyle)
PrintStyle.printStream - the print stream to which information will be sentprintStyle - the PrintStyle to be appliedNullPointerException - if the PrintStream is nullIllegalArgumentException - if the specified PrintStyle is not compatible with
PrintFormat.DETAILEDpublic Map<Counter.Type,List<Counter>> getAllCountersByType()
public void reset()
Copyright © 2022. All rights reserved.