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 |
print(PrintStream printStream)
Prints elapsed times in the specified print stream.
|
void |
print(PrintStream printStream,
PrintStyle printStyle)
Prints elapsed times in the specified print stream with a custom
PrintStyle. |
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 output for this operation.
|
String |
toString(PrintStyle printStyle)
Returns a string containing a formatted output for this operation in a custom
PrintStyle. |
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 print(PrintStream printStream)
The default PrintStyle (defined by
Performetrics.setDefaultPrintStyle(PrintStyle)) will be applied.
For a custom PrintStyle, use print(PrintStream, PrintStyle).
printStream - the print stream to which data will be sentNullPointerException - if the PrintStream is nullpublic void print(PrintStream printStream, PrintStyle printStyle)
PrintStyle.
The format (whether to generate a summarized or detailed view) will be determined by
the specified PrintStyle.
printStream - the print stream to which data will be sentprintStyle - the PrintStyle; if null, the default
PrintStyle (defined by
Performetrics.setDefaultPrintStyle(PrintStyle)) will be
appliedNullPointerException - if the PrintStream is nullpublic 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()
public String toString()
The default PrintStyle (defined by
Performetrics.setDefaultPrintStyle(PrintStyle)) will be applied.
public String toString(PrintStyle printStyle)
PrintStyle.
The PrintFormat (whether to generate a summarized or detailed view) will be
determined by the specified PrintStyle.
printStyle - the PrintStyle; if null, the default
PrintStyle (defined by
Performetrics.setDefaultPrintStyle(PrintStyle)) will be
appliedPrintStyleCopyright © 2023. All rights reserved.