01: package com.jamonapi;
02:
03: import java.util.Iterator;
04:
05: import com.jamonapi.utils.Misc;
06:
07: /**
08: * Contains the data associated with a monitor. These internals can be passed
09: * around and shared by other monitor instances that are tracking aggregate
10: * stats for the same MonKey. It mostly acts as a Struct with the exception of
11: * the reset() method.
12: *
13: * Created on December 11, 2005, 10:19 PM
14: */
15:
16: final class MonInternals {
17:
18: /** seed value to ensure that the first value always sets the max */
19: static final double MAX_DOUBLE = -Double.MAX_VALUE;
20: /** seed value to ensure that the first value always sets the min */
21: static final double MIN_DOUBLE = Double.MAX_VALUE;
22:
23: MonKey key;
24:
25: /** the total for all values */
26: double total = 0.0;
27: /** The minimum of all values */
28: double min = MIN_DOUBLE;
29: /** The maximum of all values */
30: double max = MAX_DOUBLE;
31: /** The total number of occurrences/calls to this object */
32: double hits = 0.0;
33: /** Intermediate value used to calculate std dev */
34: double sumOfSquares = 0.0;
35: /** The most recent value that was passed to this object */
36: double lastValue = 0.0;
37: /** The first time this object was accessed */
38: long firstAccess = 0;
39: /** The last time this object was accessed */
40: long lastAccess = 0;
41: /** Is this a time monitor object? Used for performance optimizations */
42: boolean isTimeMonitor = false;
43:
44: /** * jamon 2.4 from BaseMon enable/disable */
45:
46: boolean enabled = true;
47: boolean trackActivity = false;
48: String name = "";// for regular monitors empty. For range monitors
49: // "Range1_"
50: String displayHeader = "";// for regular monitors empty. rangeholder name
51: // for ranges (i.e. 0_20ms)
52:
53: /** * added for jamon 2.4 from Mon */
54: double maxActive = 0.0;
55: double totalActive = 0.0;
56: boolean isPrimary = false;
57: boolean startHasBeenCalled = true;
58: ActivityStats activityStats;
59: // from MonitorImp
60: RangeImp range;
61: double allActiveTotal; // used to calculate the average active total
62: // monitors for this distribution
63: double primaryActiveTotal;
64: double this ActiveTotal;
65:
66: Listeners listeners;
67:
68: MonInternals() {
69: listeners = new Listeners(this );
70: }
71:
72: public void reset() {
73:
74: hits = total = sumOfSquares = lastValue = 0.0;
75: firstAccess = lastAccess = 0;
76: min = MIN_DOUBLE;
77: max = MAX_DOUBLE;
78:
79: // added from mon class
80: maxActive = totalActive = 0.0;
81: activityStats.this Active.setCount(0);
82:
83: // added from frequencydistbase
84: allActiveTotal = primaryActiveTotal = this ActiveTotal = 0;
85: if (range != null)
86: range.reset();
87: }
88:
89: }
|