Package com.apple.foundationdb
Interface EventKeeper
-
- All Known Implementing Classes:
MapEventKeeper
public interface EventKeeperA device for externally instrumenting the FDB java driver, for monitoring purposes. Note that implementations as expected to be thread-safe, and may be manipulated from multiple threads even in nicely single-threaded-looking applications.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceEventKeeper.EventMarker interface for tracking the specific type of event that occurs, and metadata about said event.static classEventKeeper.EventsAn enumeration of static events which occur within the FDB Java driver.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidcount(EventKeeper.Event event, long amt)Count the number of events which occurred.longgetCount(EventKeeper.Event event)Get the number of events which occurred since this timer was created.default longgetTime(EventKeeper.Event event, java.util.concurrent.TimeUnit theUnit)Get the amount of time taken by this event, in the specified units.longgetTimeNanos(EventKeeper.Event event)Get the amount of time taken by this event, in nanoseconds.default voidincrement(EventKeeper.Event event)Convenience method to add 1 to the number of events which occurred.default voidtime(EventKeeper.Event event, long duration, java.util.concurrent.TimeUnit theUnit)Count the time taken to perform an action, in the specified units.voidtimeNanos(EventKeeper.Event event, long nanos)Count the time taken to perform an event, in nanoseconds.
-
-
-
Method Detail
-
count
void count(EventKeeper.Event event, long amt)
Count the number of events which occurred.- Parameters:
event- the event which occurredamt- the number of times that even occurred
-
increment
default void increment(EventKeeper.Event event)
Convenience method to add 1 to the number of events which occurred.- Parameters:
event- the event which occurred.
-
timeNanos
void timeNanos(EventKeeper.Event event, long nanos)
Count the time taken to perform an event, in nanoseconds. Note thatevent.isTimeEvent()should return true here.- Parameters:
event- the event which was timed (the event should be a time event).nanos- the amount of time taken (in nanoseconds)
-
time
default void time(EventKeeper.Event event, long duration, java.util.concurrent.TimeUnit theUnit)
Count the time taken to perform an action, in the specified units. Note thatevent.isTimeEvent()should return true.- Parameters:
event- the event which was timed.duration- the time takentheUnit- the unit of time in which the time measurement was taken
-
getCount
long getCount(EventKeeper.Event event)
Get the number of events which occurred since this timer was created. If the event was never recorded, then this returns 0.- Parameters:
event- the event to get the count for- Returns:
- the number of times the event was triggered. If the event has never been triggered, then this returns 0
-
getTimeNanos
long getTimeNanos(EventKeeper.Event event)
Get the amount of time taken by this event, in nanoseconds.- Parameters:
event- the event to get the time for- Returns:
- the total time measured for this event, in nanoseconds. If the event was never recorded, return 0 instead.
-
getTime
default long getTime(EventKeeper.Event event, java.util.concurrent.TimeUnit theUnit)
Get the amount of time taken by this event, in the specified units. Important note: If the time that was measured in nanoseconds does not evenly divide the unit that is specified (which is likely, considering time), then some precision may be lost in the conversion. Use this carefully.- Parameters:
event- the event to get the time fortheUnit- the unit to get time in- Returns:
- the total time measured for this event, in the specified unit. If the event was never recorded, return 0.
-
-