IBM BPM, V8.0.1, All platforms > Authoring services in Integration Designer > Developing monitor models > What are monitor models? > Monitor details models
Stopwatches and counters
Key performance indicators (KPIs) often depend on elapsed time, or on the number of occurrences of some situation or event. Stopwatches are specialized metrics that keep track of elapsed time, such as the time since the order-processing process started. Counters are specialized metrics that count occurrences, such as the number of instances of the order-processing process per day.
Counters
Counters can be incremented, decremented, or set to zero by inbound events or by triggers. You can use a counter to track, for example, the number of times a task was started within a process in which the task is contained in a loop.
The value of a counter is always an integer.
Stopwatches
Stopwatches can be started, stopped, and reset by inbound events or by triggers. When the stopwatch starts, it begins to count the elapsed time. When the stopwatch stops, it stops counting and keeps its value. If it is started again, it begins counting by adding to the previous stored value. If the stopwatch is reset, it sets the value to zero.
A running stopwatch shows the duration (elapsed time) since the point in time it was started. A stopped stopwatch shows the duration between the point in time it was started and the point in time it was stopped. The start and end times are defined by the value of the creationTime attribute included in the events that start and stop the stopwatch, so a stopwatch does not necessarily track the actual elapsed time between the arrival of the start and stop events. If a stopwatch is started or stopped by a time-based trigger (for example, a trigger that is tested once a minute), the system time of the Monitor server at the time that the trigger fired is used instead.
For example, you can use a stopwatch to track the elapsed time since a request was sent, or the time since a process started. The primary purpose of a stopwatch is to track the elapsed time since an event arrived, not the time between two events. The time between two events can be calculated from the time stamps of those events after the second event has arrived. To detect timeout situations, however, using a stopwatch is a necessity because the event indicating the end of the period being monitored might never arrive.
The value of a stopwatch is always a duration.
Accumulating stopwatches
An accumulating stopwatch is used to measure the aggregate duration of several activities that might be overlapping: each start event or trigger on an accumulating stopwatch is interpreted as the beginning of a new activity. Each stop event or trigger is interpreted as the end of an activity. The accumulating stopwatch shows the aggregate duration of those activities, just as if multiple stopwatches had been started and their times added up.
For example, if your stopwatch receives a sequence of Start Stop Start Stop commands, the results are the same whether or not you use an accumulating stopwatch. However, if your stopwatch receives a sequence of Start Start Stop Stop commands, the results are different depending on the type of stopwatch. If it is not accumulating, the elapsed time is measured from the time of the first Start to the first Stop.
If it is an accumulating stopwatch, the elapsed time is the sum of the inner elapsed time and the outer elapsed time.
For example, assume that start and stop triggers occur at these start and stop times:
0:00 1:00 1:30 2:00 Start Start Stop Stop A non-accumulating stopwatch would ignore the second start and the second stop trigger as redundant, and report a total time of 1:30.
An accumulating stopwatch would report the following duration: 1:00 (one activity running for one hour) + 2 x 0:30 (two activities running for 30 minutes) + 0:30 (one activity running for 30 minutes) for a total of 2:30.