1 package net.sf.jperfprobe;
2
3 import java.util.*;
4
5 /**
6 * Created by IntelliJ IDEA.
7 * User: tel
8 * Date: Aug 28, 2009
9 * Time: 12:23:26 AM
10 * To change this template use File | Settings | File Templates.
11 */
12 public interface ProbeManager {
13 /**
14 * Put a probe into the manager, if the probe exist it will be overwritten. This makes it possible
15 * to create a Probe outside the ProbeManager and insert it later.
16 *
17 * @param probeName
18 * @param probe
19 */
20 void put(String probeName, Probe probe);
21
22 /**
23 * Get a result for a given probe
24 *
25 * @param probeName
26 * @return Result
27 */
28 Result getResult(String probeName);
29
30 /**
31 * Get all the results
32 *
33 * @return
34 */
35 Collection<Result> getResults();
36
37 /**
38 * Get instance of a named probe, if it is non existent, a probe will be created.
39 * There will be created a probe for each thread.
40 *
41 * @param probeName identifying name of probe
42 * @return probe, null if it cant look it up
43 */
44 Probe getProbeInstance(String probeName);
45
46 /**
47 * Start probe, identified by probeName, if the probe does not exist, it will be created. see getProbeInstance
48 *
49 * @param probeName name of existing or new probe.
50 */
51 Probe start(String probeName);
52
53 /**
54 * Start probe, this probe is global for all threads, no thread private
55 * @param probeName
56 * @return
57 */
58 Probe startSingle(String probeName);
59
60 /**
61 * Stop timing. If its non existent, no time or sample will be registered.
62 *
63 * @param probeName name of probe to stop
64 */
65 void stop(String probeName);
66
67 /**
68 * Add a sample from a probe. The probe does not need to be managed by ProbeManager
69 *
70 * @param p
71 */
72 void addSampleFromProbe(Probe p);
73
74 /**
75 * Clear result for named probe
76 *
77 * @param probeName
78 */
79 void clear(String probeName);
80
81 /**
82 * Clear results for all probes
83 */
84 void clear();
85
86 /**
87 * Disable probe
88 *
89 * @param probeName
90 */
91 void disable(String probeName);
92
93 /**
94 * Disable all probes.
95 */
96 void disable();
97
98 /**
99 * Enable a named probe
100 *
101 * @param probeName
102 */
103 void enable(String probeName);
104
105 /**
106 * Enable all probes.
107 */
108 void enable();
109
110 /**
111 * Set the presentation unit for presentation.
112 *
113 * @param p presentation to set
114 */
115 void setPresentation(ProbeManagerImpl.Presentation p);
116
117 /**
118 * The the # of first samples to skip
119 * @return
120 */
121 int getFirstSamplesToSkip();
122
123 /**
124 * Set how many samples to skip in the calculation of statistics. If set to ie. 5, the first 5 samples will
125 * not be taken into account when calculating max/min/n#samples and average.
126 *
127 * @param _firstSamplesToSkip
128 */
129 void setFirstSamplesToSkip(int _firstSamplesToSkip);
130
131 /**
132 * Get the current presentation for the manager
133 *
134 * @return presentation
135 */
136 ProbeManagerImpl.Presentation getPresentation();
137
138 /**
139 * Set the Time implementation.
140 *
141 * @param tim
142 */
143 void setTime(Time tim);
144
145 /**
146 * Get the time implementation
147 *
148 * @return
149 */
150 Time getTime();
151
152 /**
153 * Get result as a string
154 *
155 * @param probe
156 * @return result
157 */
158 String toString(String probe);
159
160 /**
161 * Get all samples from a probe, as a string newline delimited
162 *
163 * @param probe
164 * @return samples
165 */
166 long[] getSamples(String probe);
167
168 /**
169 * Get all probe names in the ProbeManager
170 *
171 * @return probename
172 */
173 String[] getNames();
174 }