|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.boylesoftware.cb2.util.EventStatistics
This utility class can be used for collecting statistics on some reqularly taking place event. Each event, when it happens, is registered with an instance of this class and then various parameters about this event regularity can be obtained.
There are two ways of using this class. First is for counting
"point" events, and the second is for gathering statistics on
events that take some time for processing and you want to have
statistics on that time. In the first case you just call
eventStarted
method for each event. The
getProcTimeXxx
methods then will always be returning
-1. In the second case you call eventStarted
method
when the event processing is just started and then you call
eventFinished
when the processing has just
finished. In this case the getProcTimeXxx
method will
be returning valid computed values.
This class is thread safe. Basically all methods of this class are instance-synchronized.
Constructor Summary | |
EventStatistics()
Constructs an event statistics object. |
|
EventStatistics(EventHistory[] timelines)
Constructs an event statistics object with event history timelines. |
Method Summary | |
long |
eventFinished(long startedTs)
Registers the fact that processing of the event has finished. |
long |
eventStarted()
Registers the fact that the event has happened. |
long |
getDistAvg()
Gets the average time in milliseconds between events. |
long |
getEventsPerMinuteAvg()
Gets the average number of events per minute. |
long |
getNTimes()
Gets the number of times the event has happened. |
long |
getProcTimeAvg()
Gets the average amount of time in milliseconds processing of the event took. |
long |
getProcTimeMax()
Gets the maximum amount of time in milliseconds processing of the event took. |
long |
getProcTimeMin()
Gets the minimum amount of time in milliseconds processing of the event took. |
EventHistory[] |
getTimelines()
Gets the event history timelines. |
long |
getTsLast()
Gets the timestamp when the event happened last time. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public EventStatistics()
public EventStatistics(EventHistory[] timelines)
timelines
- array of timelines to maintain.Method Detail |
public long eventStarted()
public long eventFinished(long startedTs)
procTimeXxx
fields.
startedTs
- value returned by eventStarted
method when registering the event's start.
public long getNTimes()
public long getDistAvg()
public long getTsLast()
public long getProcTimeMin()
public long getProcTimeAvg()
public long getProcTimeMax()
public long getEventsPerMinuteAvg()
public EventHistory[] getTimelines()
null
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |