クラス org.objectweb.cjdbc.common.util.Stats

すべてのメンバ一覧

説明

This class provides thread-safe statistics. Each statistic entry is composed as follow:

作者:
Emmanuel Cecchet

Julie Marguerite

バージョン:
1.0

Stats.java43 行で定義されています。

Public メソッド

 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 ()

Private 変数

int count
int error
int cacheHit
long minTime
long maxTime
long totalTime
String name


コンストラクタとデストラクタ

org.objectweb.cjdbc.common.util.Stats.Stats String  statName  ) 
 

Creates a new Stats instance. The entries are reset to 0.

引数:
statName The stat name
Stats.java71 行で定義されています。

参照先 org.objectweb.cjdbc.common.util.Stats.name, と org.objectweb.cjdbc.common.util.Stats.reset().

00072 { 00073 name = statName; 00074 reset(); 00075 }


メソッド

void org.objectweb.cjdbc.common.util.Stats.displayOnStdout  ) 
 

Displays the statistics on the standard output. Stats.java230 行で定義されています。

参照先 org.objectweb.cjdbc.common.util.Stats.multipleLineDisplay().

00231 { 00232 System.out.println(multipleLineDisplay()); 00233 }

synchronized int org.objectweb.cjdbc.common.util.Stats.getCacheHit  ) 
 

Gets current cache hit count of an entry

戻り値:
current entry cache hit value
Stats.java169 行で定義されています。

参照先 org.objectweb.cjdbc.common.util.Stats.cacheHit.

00170 { 00171 return cacheHit; 00172 }

synchronized int org.objectweb.cjdbc.common.util.Stats.getCount  ) 
 

Gets current count of an entry.

戻り値:
current entry count value
Stats.java149 行で定義されています。

参照先 org.objectweb.cjdbc.common.util.Stats.count.

00150 { 00151 return count; 00152 }

synchronized int org.objectweb.cjdbc.common.util.Stats.getError  ) 
 

Gets current error count of an entry

戻り値:
current entry error value
Stats.java159 行で定義されています。

参照先 org.objectweb.cjdbc.common.util.Stats.error.

00160 { 00161 return error; 00162 }

synchronized long org.objectweb.cjdbc.common.util.Stats.getMaxTime  ) 
 

Gets the maximum time of an entry

戻り値:
entry maximum time
Stats.java189 行で定義されています。

参照先 org.objectweb.cjdbc.common.util.Stats.maxTime.

00190 { 00191 return maxTime; 00192 }

synchronized long org.objectweb.cjdbc.common.util.Stats.getMinTime  ) 
 

Gets the minimum time of an entry

戻り値:
entry minimum time
Stats.java179 行で定義されています。

参照先 org.objectweb.cjdbc.common.util.Stats.minTime.

00180 { 00181 return minTime; 00182 }

String org.objectweb.cjdbc.common.util.Stats.getName  ) 
 

Gets the name of the current stat.

戻り値:
stat name
Stats.java139 行で定義されています。

参照先 org.objectweb.cjdbc.common.util.Stats.name.

参照元 org.objectweb.cjdbc.controller.monitoring.SQLMonitoring.logCacheHit(), org.objectweb.cjdbc.controller.monitoring.SQLMonitoring.logError(), と org.objectweb.cjdbc.controller.monitoring.SQLMonitoring.logRequestTime().

00140 { 00141 return name; 00142 }

synchronized long org.objectweb.cjdbc.common.util.Stats.getTotalTime  ) 
 

Gets the total time of an entry

戻り値:
entry total time
Stats.java199 行で定義されています。

参照先 org.objectweb.cjdbc.common.util.Stats.totalTime.

00200 { 00201 return totalTime; 00202 }

synchronized void org.objectweb.cjdbc.common.util.Stats.incrementCacheHit  ) 
 

Increments an entry cache hit by one. Stats.java108 行で定義されています。

参照先 org.objectweb.cjdbc.common.util.Stats.cacheHit.

参照元 org.objectweb.cjdbc.controller.monitoring.SQLMonitoring.logCacheHit().

00109 { 00110 cacheHit++; 00111 }

synchronized void org.objectweb.cjdbc.common.util.Stats.incrementCount  ) 
 

Increments an entry count by one. Stats.java92 行で定義されています。

参照先 org.objectweb.cjdbc.common.util.Stats.count.

参照元 org.objectweb.cjdbc.controller.monitoring.SQLMonitoring.logRequestTime().

00093 { 00094 count++; 00095 }

synchronized void org.objectweb.cjdbc.common.util.Stats.incrementError  ) 
 

Increments an entry error by one. Stats.java100 行で定義されています。

参照先 org.objectweb.cjdbc.common.util.Stats.error.

参照元 org.objectweb.cjdbc.controller.monitoring.SQLMonitoring.logError().

00101 { 00102 error++; 00103 }

synchronized void org.objectweb.cjdbc.common.util.Stats.merge Stats  anotherStat  )  throws Exception
 

Adds the entries of another Stats object to this one.

引数:
anotherStat stat to merge with current stat
例外:
Exception if you try to merge a stat with itself
Stats.java210 行で定義されています。

参照先 org.objectweb.cjdbc.common.util.Stats.cacheHit, org.objectweb.cjdbc.common.util.Stats.count, org.objectweb.cjdbc.common.util.Stats.error, org.objectweb.cjdbc.common.util.Stats.maxTime, org.objectweb.cjdbc.common.util.Stats.minTime, と org.objectweb.cjdbc.common.util.Stats.totalTime.

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 }

String org.objectweb.cjdbc.common.util.Stats.multipleLineDisplay  ) 
 

Displays the statistics information on multiple lines.

戻り値:
a String containing the Stat output
Stats.java240 行で定義されています。

参照先 org.objectweb.cjdbc.common.util.Stats.count, org.objectweb.cjdbc.common.util.Stats.error, org.objectweb.cjdbc.common.util.Stats.maxTime, org.objectweb.cjdbc.common.util.Stats.minTime, org.objectweb.cjdbc.common.util.Stats.name, と org.objectweb.cjdbc.common.util.Stats.totalTime.

参照元 org.objectweb.cjdbc.common.util.Stats.displayOnStdout().

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 }

synchronized void org.objectweb.cjdbc.common.util.Stats.reset  ) 
 

Resets all entries to 0. Stats.java80 行で定義されています。

参照先 org.objectweb.cjdbc.common.util.Stats.count, org.objectweb.cjdbc.common.util.Stats.error, org.objectweb.cjdbc.common.util.Stats.maxTime, org.objectweb.cjdbc.common.util.Stats.minTime, と org.objectweb.cjdbc.common.util.Stats.totalTime.

参照元 org.objectweb.cjdbc.controller.monitoring.SQLMonitoring.resetRequestStat(), と org.objectweb.cjdbc.common.util.Stats.Stats().

00081 { 00082 count = 0; 00083 error = 0; 00084 minTime = Long.MAX_VALUE; 00085 maxTime = Long.MIN_VALUE; 00086 totalTime = 0; 00087 }

String org.objectweb.cjdbc.common.util.Stats.singleLineDisplay  ) 
 

Displays the statistics information on a single line in the format: name count error cacheHit hit minTime maxTime avgTime totalTime

戻り値:
a String containing the Stat output
Stats.java274 行で定義されています。

参照先 org.objectweb.cjdbc.common.util.Stats.cacheHit, org.objectweb.cjdbc.common.util.Stats.count, org.objectweb.cjdbc.common.util.Stats.error, org.objectweb.cjdbc.common.util.Stats.maxTime, org.objectweb.cjdbc.common.util.Stats.minTime, org.objectweb.cjdbc.common.util.Stats.name, と org.objectweb.cjdbc.common.util.Stats.totalTime.

参照元 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 }

String [] org.objectweb.cjdbc.common.util.Stats.toStringTable  ) 
 

Get the stat information in the form of a String table. Format is: name count error cacheHit hit minTime maxTime avgTime totalTime

戻り値:
the String table corresponding to this stat
Stats.java304 行で定義されています。

参照先 org.objectweb.cjdbc.common.util.Stats.cacheHit, org.objectweb.cjdbc.common.util.Stats.count, org.objectweb.cjdbc.common.util.Stats.error, org.objectweb.cjdbc.common.util.Stats.maxTime, org.objectweb.cjdbc.common.util.Stats.minTime, org.objectweb.cjdbc.common.util.Stats.name, と org.objectweb.cjdbc.common.util.Stats.totalTime.

参照元 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 }

synchronized void org.objectweb.cjdbc.common.util.Stats.updateTime long  time  ) 
 

Adds a new time sample for this entry. time is added to total time and both minTime and maxTime are updated if needed.

引数:
time time to add to this entry
Stats.java119 行で定義されています。

参照先 org.objectweb.cjdbc.common.util.Stats.maxTime, org.objectweb.cjdbc.common.util.Stats.minTime, と org.objectweb.cjdbc.common.util.Stats.totalTime.

参照元 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 }


変数

int org.objectweb.cjdbc.common.util.Stats.cacheHit [private]
 

Cache hits counter Stats.java52 行で定義されています。

参照元 org.objectweb.cjdbc.common.util.Stats.getCacheHit(), org.objectweb.cjdbc.common.util.Stats.incrementCacheHit(), org.objectweb.cjdbc.common.util.Stats.merge(), org.objectweb.cjdbc.common.util.Stats.singleLineDisplay(), と org.objectweb.cjdbc.common.util.Stats.toStringTable().

int org.objectweb.cjdbc.common.util.Stats.count [private]
 

Statistic counter Stats.java46 行で定義されています。

参照元 org.objectweb.cjdbc.common.util.Stats.getCount(), org.objectweb.cjdbc.common.util.Stats.incrementCount(), org.objectweb.cjdbc.common.util.Stats.merge(), org.objectweb.cjdbc.common.util.Stats.multipleLineDisplay(), org.objectweb.cjdbc.common.util.Stats.reset(), org.objectweb.cjdbc.common.util.Stats.singleLineDisplay(), と org.objectweb.cjdbc.common.util.Stats.toStringTable().

int org.objectweb.cjdbc.common.util.Stats.error [private]
 

Statistic error counter Stats.java49 行で定義されています。

参照元 org.objectweb.cjdbc.common.util.Stats.getError(), org.objectweb.cjdbc.common.util.Stats.incrementError(), org.objectweb.cjdbc.common.util.Stats.merge(), org.objectweb.cjdbc.common.util.Stats.multipleLineDisplay(), org.objectweb.cjdbc.common.util.Stats.reset(), org.objectweb.cjdbc.common.util.Stats.singleLineDisplay(), と org.objectweb.cjdbc.common.util.Stats.toStringTable().

long org.objectweb.cjdbc.common.util.Stats.maxTime [private]
 

Maximum time for this entry (automatically computed) Stats.java58 行で定義されています。

参照元 org.objectweb.cjdbc.common.util.Stats.getMaxTime(), org.objectweb.cjdbc.common.util.Stats.merge(), org.objectweb.cjdbc.common.util.Stats.multipleLineDisplay(), org.objectweb.cjdbc.common.util.Stats.reset(), org.objectweb.cjdbc.common.util.Stats.singleLineDisplay(), org.objectweb.cjdbc.common.util.Stats.toStringTable(), と org.objectweb.cjdbc.common.util.Stats.updateTime().

long org.objectweb.cjdbc.common.util.Stats.minTime [private]
 

Minimum time for this entry (automatically computed) Stats.java55 行で定義されています。

参照元 org.objectweb.cjdbc.common.util.Stats.getMinTime(), org.objectweb.cjdbc.common.util.Stats.merge(), org.objectweb.cjdbc.common.util.Stats.multipleLineDisplay(), org.objectweb.cjdbc.common.util.Stats.reset(), org.objectweb.cjdbc.common.util.Stats.singleLineDisplay(), org.objectweb.cjdbc.common.util.Stats.toStringTable(), と org.objectweb.cjdbc.common.util.Stats.updateTime().

String org.objectweb.cjdbc.common.util.Stats.name [private]
 

Name of the stats. Stats.java64 行で定義されています。

参照元 org.objectweb.cjdbc.common.util.Stats.getName(), org.objectweb.cjdbc.common.util.Stats.multipleLineDisplay(), org.objectweb.cjdbc.common.util.Stats.singleLineDisplay(), org.objectweb.cjdbc.common.util.Stats.Stats(), と org.objectweb.cjdbc.common.util.Stats.toStringTable().

long org.objectweb.cjdbc.common.util.Stats.totalTime [private]
 

Total time for this entry Stats.java61 行で定義されています。

参照元 org.objectweb.cjdbc.common.util.Stats.getTotalTime(), org.objectweb.cjdbc.common.util.Stats.merge(), org.objectweb.cjdbc.common.util.Stats.multipleLineDisplay(), org.objectweb.cjdbc.common.util.Stats.reset(), org.objectweb.cjdbc.common.util.Stats.singleLineDisplay(), org.objectweb.cjdbc.common.util.Stats.toStringTable(), と org.objectweb.cjdbc.common.util.Stats.updateTime().


このクラスの説明は次のファイルから生成されました:
CJDBCversion1.0.4に対してTue Oct 12 15:16:19 2004に生成されました。 doxygen 1.3.8