public class UnmodifiableTimingSession extends TimingSession
A "wrapper" class that allows retrieving values from an existing TimingSession
but prevents users from modifying it.
TimingSession| Constructor and Description |
|---|
UnmodifiableTimingSession(TimingSession timingSession)
Creates an unmodifiable object for a preset
TimingSession. |
| Modifier and Type | Method and Description |
|---|---|
Duration |
elapsedTime(Counter.Type type)
A convenient method that returns the elapsed time of a specific counter.
|
double |
elapsedTime(Counter.Type type,
TimeUnit timeUnit)
A convenient method that returns the elapsed time of a specific counter, in the
specified time unit.
|
double |
elapsedTime(Counter.Type type,
TimeUnit timeUnit,
ConversionMode conversionMode)
A convenient method that returns the elapsed time of a specific counter, in the
specified time unit, by applying a custom
ConversionMode. |
boolean |
isStarted()
Returns
true if this timing session is started. |
void |
reset()
Resets all counters associated with this timing session.
|
void |
start()
Starts the timing session.
|
void |
stop()
Stops the timing session.
|
public UnmodifiableTimingSession(TimingSession timingSession)
TimingSession.timingSession - the TimingSession to be wrappedpublic void reset()
TimingSessionreset in class TimingSessionpublic void start()
TimingSessionstart in class TimingSessionpublic void stop()
TimingSessionstop in class TimingSessionpublic boolean isStarted()
TimingSessiontrue if this timing session is started.isStarted in class TimingSessionpublic Duration elapsedTime(Counter.Type type)
TimingSession
This has the same effect as calling:
timingSession.getCounter(type).elapsedTime()
elapsedTime in class TimingSessiontype - the counter type to be fetchedpublic double elapsedTime(Counter.Type type, TimeUnit timeUnit)
TimingSession
This has the same effect as calling:
timingSession.getCounter(type).elapsedTime(timeUnit)
elapsedTime in class TimingSessiontype - the counter type to be fetchedtimeUnit - the time unit to which the elapsed time will be convertedpublic double elapsedTime(Counter.Type type, TimeUnit timeUnit, ConversionMode conversionMode)
TimingSessionConversionMode.
This has the same effect as calling:
timingSession.getCounter(type).elapsedTime(timeUnit, conversionMode)
elapsedTime in class TimingSessiontype - the counter type to be fetchedtimeUnit - the time unit to which the elapsed time will be convertedconversionMode - the ConversionMode to be appliedCopyright © 2023. All rights reserved.