public abstract class ExecutionTimeRecorder extends Object
Constructor and Description |
---|
ExecutionTimeRecorder() |
Modifier and Type | Method and Description |
---|---|
abstract boolean |
isOperationAlreadyRecorded(String operationIdentifier)
Has a particular operation already been recorded?
|
abstract long |
measureTime(boolean start,
String... operationIdentifiers)
Indicates
operationIdentifier is being recorded, and returns the current clock
timestamp. |
abstract RecordedExecutionTimes |
recordedTimes()
The execution-times that have been recorded.
|
<E extends Exception> |
recordExecutionTime(String operationIdentifier,
CheckedRunnable<E> operation)
Executes an
operation while recording the execution-time - without a return
type. |
<T,E extends Exception> |
recordExecutionTime(String operationIdentifier,
CheckedSupplier<T,E> operation)
Executes an
operation while recording the execution-time - with a return type. |
abstract void |
recordExecutionTime(String operationIdentifier,
long millis)
Records the execution-time of a particular operation.
|
void |
recordExecutionTimeUnchecked(String operationIdentifier,
Runnable operation)
Executes an
operation while recording the execution-time - without a return type,
and without throwing an exception.. |
void |
recordTimeDifferenceBetween(String operationIdentifier,
long startTimestamp,
long endTimestamp)
Records the execution-time of a particular operation by subtracting the start-time from the
end time.
|
public abstract RecordedExecutionTimes recordedTimes()
RecordedExecutionTimes
that describes the execution-times.public abstract void recordExecutionTime(String operationIdentifier, long millis)
operationIdentifier
- a string uniquely identifying the operation.millis
- how long the operation took in milliseconds.public abstract boolean isOperationAlreadyRecorded(String operationIdentifier)
operationIdentifier
- a string uniquely identifying the operation.public void recordExecutionTimeUnchecked(String operationIdentifier, Runnable operation)
operation
while recording the execution-time - without a return type,
and without throwing an exception..
Operation times are always executed, even they throw an Exception or otherwise end in failure.
operationIdentifier
- an identifier for this type of write-operation, under which
execution-times are aggregated.operation
- the operation to executepublic <E extends Exception> void recordExecutionTime(String operationIdentifier, CheckedRunnable<E> operation) throws E extends Exception
operation
while recording the execution-time - without a return
type.
Operation times are always executed, even they throw an Exception or otherwise end in failure.
E
- type of an exception that operation
may throw.operationIdentifier
- an identifier for this type of write-operation, under which
execution-times are aggregated.operation
- the operation to executeE
- if operation
throws this exception;E extends Exception
public <T,E extends Exception> T recordExecutionTime(String operationIdentifier, CheckedSupplier<T,E> operation) throws E extends Exception
operation
while recording the execution-time - with a return type.
Operation times are always executed, even they throw an Exception or otherwise end in failure.
T
- return-type of operation
.E
- type of an exception that operation
may throw.operationIdentifier
- an identifier for this type of write-operation, under which
execution-times are aggregated.operation
- the operation to executeoperation
.E
- if operation
throws this exception,E extends Exception
public void recordTimeDifferenceBetween(String operationIdentifier, long startTimestamp, long endTimestamp)
operationIdentifier
- a string uniquely identifying the operation.startTimestamp
- a system clock timestamp (in milliseconds since the epoch) for when the
operation began.endTimestamp
- a system clock timestamp (in milliseconds since the epoch) for when the
operation ended.public abstract long measureTime(boolean start, String... operationIdentifiers)
operationIdentifier
is being recorded, and returns the current clock
timestamp.start
- true, if this time indicates the start of an operation. false, if it only
describes the end.operationIdentifiers
- all possible identifiers that may subsequently be used to record
an end-time for this operation.Copyright © 2010–2023 Owen Feehan, ETH Zurich, University of Zurich, Hoffmann-La Roche. All rights reserved.