001    package patterntesting.runtime.monitor;
002    
003    import java.util.Date;
004    
005    /**
006     * The Interface ProfileMonitor.
007     */
008    public interface ProfileMonitor extends Comparable<ProfileMonitor> {
009    
010        /**
011         * Gets the monitors.
012         *
013         * @return the monitors
014         */
015        ProfileMonitor[] getMonitors();
016    
017        /**
018         * Start.
019         */
020        void start();
021    
022        /**
023         * Stop.
024         */
025        void stop();
026    
027        /**
028         * Reset.
029         */
030        void reset();
031    
032        /**
033         * Gets the label.
034         *
035         * @return the label
036         */
037        String getLabel();
038    
039        /**
040         * Normally this method should be synchronized. But we waive it with the
041         * risk that the measured time may be slightly wrong.
042         *
043         * @param value the value
044         */
045        void add(double value);
046    
047        /**
048         * Gets the total.
049         *
050         * @return the total
051         */
052        double getTotal();
053    
054        /**
055         * Gets the last value.
056         *
057         * @return the last value (in ms)
058         */
059        double getLastValue();
060    
061        /**
062         * Gets the last value as time string. It should return the same result
063         * as {@link #getLastValue()} but in a human readable format.
064         *
065         * @return the last time (e.g. "42 seconds")
066         * @since 1.4.2
067         */
068        String getLastTime();
069    
070        /**
071         * Gets the max.
072         *
073         * @return the max
074         */
075        double getMax();
076    
077        /**
078         * Gets the min.
079         *
080         * @return the min
081         */
082        double getMin();
083    
084        /**
085         * Gets the hits.
086         *
087         * @return the hits
088         */
089        int getHits();
090    
091        /**
092         * Gets the avg.
093         *
094         * @return the avg
095         */
096        double getAvg();
097    
098        /**
099         * To short string.
100         *
101         * @return the string
102         */
103        String toShortString();
104    
105        /**
106         * To csv string.
107         *
108         * @return the string
109         */
110        String toCsvString();
111    
112        /**
113         * To csv headline.
114         *
115         * @return the string
116         */
117        String toCsvHeadline();
118    
119        /**
120         * Gets the active.
121         *
122         * @return the active
123         */
124        double getActive();
125    
126        /**
127         * Gets the avg active.
128         *
129         * @return the avg active
130         */
131        double getAvgActive();
132    
133        /**
134         * Gets the max active.
135         *
136         * @return the max active
137         */
138        double getMaxActive();
139    
140        /**
141         * Gets the first access.
142         *
143         * @return the first access
144         */
145        Date getFirstAccess();
146    
147        /**
148         * Gets the last access.
149         *
150         * @return the last access
151         */
152        Date getLastAccess();
153    
154        /**
155         * Gets the units.
156         *
157         * @return the units
158         */
159        String getUnits();
160    
161    }