src/org/objectweb/cjdbc/controller/cache/CacheStatistics.java

説明を見る。
00001 00025 package org.objectweb.cjdbc.controller.cache; 00026 00027 import org.objectweb.cjdbc.common.util.Stats; 00028 00035 public class CacheStatistics 00036 { 00037 // Cache statistics 00038 private Stats select; 00039 private Stats hits; 00040 private Stats insert; 00041 private Stats update; 00042 private Stats uncacheable; 00043 private Stats delete; 00044 private Stats unknown; 00045 private Stats remove; 00046 private Stats create; 00047 private Stats drop; 00048 00052 public CacheStatistics() 00053 { 00054 select = new Stats("select"); 00055 hits = new Stats("hits"); 00056 insert = new Stats("insert"); 00057 update = new Stats("update"); 00058 uncacheable = new Stats("uncacheable"); 00059 delete = new Stats("delete"); 00060 unknown = new Stats("unknown"); 00061 remove = new Stats("remove"); 00062 create = new Stats("create"); 00063 drop = new Stats("drop"); 00064 } 00065 00069 public void reset() 00070 { 00071 select.reset(); 00072 hits.reset(); 00073 insert.reset(); 00074 update.reset(); 00075 uncacheable.reset(); 00076 delete.reset(); 00077 unknown.reset(); 00078 remove.reset(); 00079 create.reset(); 00080 drop.reset(); 00081 } 00082 00088 public int getCreate() 00089 { 00090 return create.getCount(); 00091 } 00092 00098 public int getDelete() 00099 { 00100 return delete.getCount(); 00101 } 00102 00108 public int getDrop() 00109 { 00110 return drop.getCount(); 00111 } 00112 00118 public int getHits() 00119 { 00120 return hits.getCount(); 00121 } 00122 00128 public int getInsert() 00129 { 00130 return insert.getCount(); 00131 } 00132 00138 public int getRemove() 00139 { 00140 return remove.getCount(); 00141 } 00142 00148 public int getSelect() 00149 { 00150 return select.getCount(); 00151 } 00152 00158 public int getUnknown() 00159 { 00160 return unknown.getCount(); 00161 } 00162 00168 public int getUpdate() 00169 { 00170 return update.getCount(); 00171 } 00172 00178 public int getUncacheable() 00179 { 00180 return uncacheable.getCount(); 00181 } 00182 00186 public void addCreate() 00187 { 00188 create.incrementCount(); 00189 } 00190 00194 public void addDelete() 00195 { 00196 delete.incrementCount(); 00197 } 00198 00202 public void addDrop() 00203 { 00204 drop.incrementCount(); 00205 } 00206 00210 public void addHits() 00211 { 00212 hits.incrementCount(); 00213 } 00214 00218 public void addInsert() 00219 { 00220 insert.incrementCount(); 00221 } 00222 00226 public void addRemove() 00227 { 00228 remove.incrementCount(); 00229 } 00230 00234 public void addSelect() 00235 { 00236 select.incrementCount(); 00237 } 00238 00242 public void addUnknown() 00243 { 00244 unknown.incrementCount(); 00245 } 00246 00250 public void addUpdate() 00251 { 00252 update.incrementCount(); 00253 } 00254 00258 public void addUncacheable() 00259 { 00260 uncacheable.incrementCount(); 00261 } 00262 00269 public String[] getCacheStatsData() 00270 { 00271 String[] stats = new String[11]; 00272 stats[0] = "" + getSelect(); 00273 stats[1] = "" + getHits(); 00274 stats[2] = "" + getInsert(); 00275 stats[3] = "" + getUpdate(); 00276 stats[4] = "" + getUncacheable(); 00277 stats[5] = "" + getDelete(); 00278 stats[6] = "" + getUnknown(); 00279 stats[7] = "" + getRemove(); 00280 stats[8] = "" + getCreate(); 00281 stats[9] = "" + getDrop(); 00282 stats[10] = "" + getCacheHitRatio(); 00283 return stats; 00284 } 00285 00291 public long getCacheHitRatio() 00292 { 00293 if (select.getCount() == 0) 00294 return 0; 00295 else 00296 return (long) ((float) hits.getCount() / (float) select.getCount() * 100.0); 00297 } 00298 }

CJDBCversion1.0.4に対してTue Oct 12 15:16:00 2004に生成されました。 doxygen 1.3.8