Package com.apple.foundationdb
Interface EventKeeper
- All Known Implementing Classes:
MapEventKeeper
public interface EventKeeper
A 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 ClassesModifier and TypeInterfaceDescriptionstatic interfaceMarker interface for tracking the specific type of event that occurs, and metadata about said event.static enumAn enumeration of static events which occur within the FDB Java driver. -
Method Summary
Modifier and TypeMethodDescriptionvoidcount(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, 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, 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 Details
-
count
Count the number of events which occurred.- Parameters:
event- the event which occurredamt- the number of times that even occurred
-
increment
Convenience method to add 1 to the number of events which occurred.- Parameters:
event- the event which occurred.
-
timeNanos
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
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
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
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
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.
-