Public Member Functions | |
Stats (String statName) | |
synchronized void | reset () |
synchronized void | incrementCount () |
synchronized void | incrementError () |
synchronized void | incrementCacheHit () |
synchronized void | updateTime (long time) |
String | getName () |
synchronized int | getCount () |
synchronized int | getError () |
synchronized int | getCacheHit () |
synchronized long | getMinTime () |
synchronized long | getMaxTime () |
synchronized long | getTotalTime () |
synchronized void | merge (Stats anotherStat) throws Exception |
void | displayOnStdout () |
String | multipleLineDisplay () |
String | singleLineDisplay () |
String[] | toStringTable () |
Definition at line 43 of file Stats.java.
|
Creates a new
Definition at line 71 of file Stats.java. 00072 { 00073 name = statName; 00074 reset(); 00075 }
|
|
Displays the statistics on the standard output. Definition at line 230 of file Stats.java. 00231 { 00232 System.out.println(multipleLineDisplay()); 00233 }
|
|
Gets current cache hit count of an entry
Definition at line 169 of file Stats.java. 00170 {
00171 return cacheHit;
00172 }
|
|
Gets current count of an entry.
Definition at line 149 of file Stats.java. 00150 {
00151 return count;
00152 }
|
|
Gets current error count of an entry
Definition at line 159 of file Stats.java. 00160 {
00161 return error;
00162 }
|
|
Gets the maximum time of an entry
Definition at line 189 of file Stats.java. 00190 {
00191 return maxTime;
00192 }
|
|
Gets the minimum time of an entry
Definition at line 179 of file Stats.java. 00180 {
00181 return minTime;
00182 }
|
|
Gets the name of the current stat.
Definition at line 139 of file Stats.java. Referenced by org.objectweb.cjdbc.controller.monitoring.SQLMonitoring.logCacheHit(), org.objectweb.cjdbc.controller.monitoring.SQLMonitoring.logError(), and org.objectweb.cjdbc.controller.monitoring.SQLMonitoring.logRequestTime(). 00140 {
00141 return name;
00142 }
|
|
Gets the total time of an entry
Definition at line 199 of file Stats.java. 00200 {
00201 return totalTime;
00202 }
|
|
Increments an entry cache hit by one. Definition at line 108 of file Stats.java. Referenced by org.objectweb.cjdbc.controller.monitoring.SQLMonitoring.logCacheHit(). 00109 { 00110 cacheHit++; 00111 }
|
|
Increments an entry count by one. Definition at line 92 of file Stats.java. Referenced by org.objectweb.cjdbc.controller.monitoring.SQLMonitoring.logRequestTime(). 00093 { 00094 count++; 00095 }
|
|
Increments an entry error by one. Definition at line 100 of file Stats.java. Referenced by org.objectweb.cjdbc.controller.monitoring.SQLMonitoring.logError(). 00101 { 00102 error++; 00103 }
|
|
Adds the entries of another
Definition at line 210 of file Stats.java. 00211 { 00212 if (this == anotherStat) 00213 { 00214 throw new Exception("You cannot merge a stat with itself"); 00215 } 00216 00217 count += anotherStat.getCount(); 00218 error += anotherStat.getError(); 00219 cacheHit += anotherStat.getCacheHit(); 00220 if (minTime > anotherStat.getMinTime()) 00221 minTime = anotherStat.getMinTime(); 00222 if (maxTime < anotherStat.getMaxTime()) 00223 maxTime = anotherStat.getMaxTime(); 00224 totalTime += anotherStat.getTotalTime(); 00225 }
|
|
Displays the statistics information on multiple lines.
Definition at line 240 of file Stats.java. 00241 { 00242 String output = name + " statistics:\n" + " Count: " + count + "\n" 00243 + " Error: " + error + "\n"; 00244 if (totalTime != 0) 00245 { 00246 output += " Min time: " + minTime + " ms\n"; 00247 output += " Max time: " + maxTime + " ms\n"; 00248 } 00249 else 00250 { 00251 output += " Min time: 0 ms\n"; 00252 output += " Max time: 0 ms\n"; 00253 } 00254 if (count == 0) 00255 output += " Avg time: 0 ms\n"; 00256 else 00257 output += " Avg time: " + totalTime / count + " ms\n"; 00258 output += " Tot time: " + totalTime + " ms\n"; 00259 00260 double timeSec = totalTime / 1000; 00261 double timeMin = timeSec / 60, throup; 00262 throup = (timeMin != 0) ? (count / timeMin) : (count / timeSec); 00263 output += " Throughput: " + throup 00264 + ((timeMin != 0) ? " requests/minute" : " requests/second"); 00265 return output; 00266 }
|
|
Resets all entries to 0. Definition at line 80 of file Stats.java. Referenced by org.objectweb.cjdbc.controller.monitoring.SQLMonitoring.resetRequestStat(). 00081 { 00082 count = 0; 00083 error = 0; 00084 minTime = Long.MAX_VALUE; 00085 maxTime = Long.MIN_VALUE; 00086 totalTime = 0; 00087 }
|
|
Displays the statistics information on a single line in the format: name count error cacheHit hit minTime maxTime avgTime totalTime
Definition at line 274 of file Stats.java. Referenced by org.objectweb.cjdbc.controller.monitoring.SQLMonitoring.dumpAllStatsInformation(). 00275 { 00276 String output = name + " " + count + " " + error + " " + cacheHit + " "; 00277 if (count == 0) 00278 output += "0 "; 00279 else 00280 output += ((double) cacheHit / (double) count * 100.0) + " "; 00281 if (totalTime != 0) 00282 output += minTime + " " + maxTime + " "; 00283 else 00284 output += " 0 0 "; 00285 if (count == 0) 00286 output += "0 "; 00287 else 00288 output += totalTime / count + " "; 00289 output += totalTime; 00290 double timeSec = totalTime / 1000; 00291 double timeMin = timeSec / 60, throup; 00292 throup = (timeMin != 0) ? (count / timeMin) : (count / timeSec); 00293 output += throup 00294 + ((timeMin != 0) ? " requests/minute" : " requests/second"); 00295 return output; 00296 }
|
|
Get the stat information in the form of a String table. Format is: name count error cacheHit hit minTime maxTime avgTime totalTime
Definition at line 304 of file Stats.java. Referenced by org.objectweb.cjdbc.controller.monitoring.SQLMonitoring.getAllStatsInformation(). 00305 { 00306 String[] foo = { 00307 name, 00308 Integer.toString(count), 00309 Integer.toString(error), 00310 Integer.toString(cacheHit), 00311 (count == 0) ? "0" : Float.toString((float) cacheHit / (float) count 00312 * (float) 100.0), Long.toString(minTime), Long.toString(maxTime), 00313 (count == 0) ? "0" : Float.toString((float) totalTime / (float) count), 00314 Long.toString(totalTime)}; 00315 return foo; 00316 }
|
|
Adds a new time sample for this entry.
Definition at line 119 of file Stats.java. Referenced by org.objectweb.cjdbc.controller.monitoring.SQLMonitoring.logRequestTime(). 00120 { 00121 if (time < 0) 00122 { 00123 System.err.println("Negative time received in Stats.updateTime(" + time 00124 + ")\n"); 00125 return; 00126 } 00127 totalTime += time; 00128 if (time > maxTime) 00129 maxTime = time; 00130 if (time < minTime) 00131 minTime = time; 00132 }
|