Class StoreTimerSnapshot
- java.lang.Object
-
- com.apple.foundationdb.record.provider.common.StoreTimerSnapshot
-
@API(MAINTAINED) public final class StoreTimerSnapshot extends Object
An immutable snapshot of aStoreTimer
.Subtracting a snapshot of a timer from the original timer after subsequent operations have been performed and timed can provide useful metrics as to the cost of those subsequent operations. See
StoreTimer.getDifference(StoreTimer, StoreTimerSnapshot)
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
StoreTimerSnapshot.CounterSnapshot
An immutable snapshot of aStoreTimer.Counter
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
containsCounter(StoreTimer.Event event)
Determine if there is a counter recorded for a given event.boolean
containsTimeoutCounter(StoreTimer.Event event)
Determine if there is a timeout counter recorded for a given event.boolean
derivedFrom(StoreTimer timer)
Determine if this snapshot is derived from the provided timer.static StoreTimerSnapshot
from(StoreTimer timer)
Creates an immutable snapshot of aStoreTimer
.Map<StoreTimer.Event,StoreTimerSnapshot.CounterSnapshot>
getCounters()
Returns the counters taken at the time of the snapshot.StoreTimerSnapshot.CounterSnapshot
getCounterSnapshot(StoreTimer.Event event)
Get the counter for a given event.Map<StoreTimer.Event,StoreTimerSnapshot.CounterSnapshot>
getTimeoutCounters()
Returns the timeout counters taken at the time of the snapshot.StoreTimerSnapshot.CounterSnapshot
getTimeoutCounterSnapshot(StoreTimer.Event event)
Get the timeout counter for a given event.void
setResetTime(StoreTimer timer)
Set the reset time on the provided timer to the create time of this snapshot.boolean
takenAfterReset(StoreTimer timer)
Determine if this snapshot was taken after the provided timer was last reset.
-
-
-
Method Detail
-
from
@Nonnull public static StoreTimerSnapshot from(@Nonnull StoreTimer timer)
Creates an immutable snapshot of aStoreTimer
.- Parameters:
timer
- to create the snapshot from- Returns:
- immutable snapshot of the provided timer
-
getCounters
public Map<StoreTimer.Event,StoreTimerSnapshot.CounterSnapshot> getCounters()
Returns the counters taken at the time of the snapshot.- Returns:
- the counters taken at the time of the snapshot.
-
getTimeoutCounters
public Map<StoreTimer.Event,StoreTimerSnapshot.CounterSnapshot> getTimeoutCounters()
Returns the timeout counters taken at the time of the snapshot.- Returns:
- the timeout counters taken at the time of the snapshot.
-
getCounterSnapshot
@Nullable public StoreTimerSnapshot.CounterSnapshot getCounterSnapshot(@Nonnull StoreTimer.Event event)
Get the counter for a given event.- Parameters:
event
- the event of interest- Returns:
- immutable counter if it exists or null otherwise
-
containsCounter
public boolean containsCounter(@Nonnull StoreTimer.Event event)
Determine if there is a counter recorded for a given event.- Parameters:
event
- the event of interest- Returns:
- true if a counter exists for the event of interest
-
getTimeoutCounterSnapshot
@Nullable public StoreTimerSnapshot.CounterSnapshot getTimeoutCounterSnapshot(@Nonnull StoreTimer.Event event)
Get the timeout counter for a given event.- Parameters:
event
- the event of interest- Returns:
- immutable timeout counter if it exists or null otherwise
-
containsTimeoutCounter
public boolean containsTimeoutCounter(@Nonnull StoreTimer.Event event)
Determine if there is a timeout counter recorded for a given event.- Parameters:
event
- the event of interest- Returns:
- true if a timeout counter exists for the event of interest
-
derivedFrom
public boolean derivedFrom(StoreTimer timer)
Determine if this snapshot is derived from the provided timer.- Parameters:
timer
- the provided timer- Returns:
- true if it is valid to diff this snapshot from the provided timer
-
takenAfterReset
public boolean takenAfterReset(StoreTimer timer)
Determine if this snapshot was taken after the provided timer was last reset.- Parameters:
timer
- the provided timer- Returns:
- true if this snapshot was taken after the provided timer was last reset
-
setResetTime
public void setResetTime(StoreTimer timer)
Set the reset time on the provided timer to the create time of this snapshot.- Parameters:
timer
- the provided timer to srt
-
-