1 package org.hibernate.stat; 3 4 5 12 public class QueryStatistics extends CategorizedStatistics { 13 14 QueryStatistics(String query) { 15 super(query); 16 } 17 18 long cacheHitCount; 19 long cacheMissCount; 20 long cachePutCount; 21 private long executionCount; 22 private long executionRowCount; 23 private long executionAvgTime; 24 private long executionMaxTime; 25 private long executionMinTime; 26 27 30 public long getExecutionCount() { 31 return executionCount; 32 } 33 34 37 public long getCacheHitCount() { 38 return cacheHitCount; 39 } 40 41 public long getCachePutCount() { 42 return cachePutCount; 43 } 44 45 public long getCacheMissCount() { 46 return cacheMissCount; 47 } 48 49 55 public long getExecutionRowCount() { 56 return executionRowCount; 57 } 58 59 62 public long getExecutionAvgTime() { 63 return executionAvgTime; 64 } 65 66 69 public long getExecutionMaxTime() { 70 return executionMaxTime; 71 } 72 73 76 public long getExecutionMinTime() { 77 return executionMinTime; 78 } 79 80 86 void executed(long rows, long time) { 87 if (time < executionMinTime) executionMinTime = time; 88 if (time > executionMaxTime) executionMaxTime = time; 89 executionAvgTime = ( executionAvgTime * executionCount + time ) / ( executionCount + 1 ); 90 executionCount++; 91 executionRowCount += rows; 92 } 93 94 public String toString() { 95 return new StringBuffer () 96 .append("QueryStatistics") 97 .append("[cacheHitCount=").append(this.cacheHitCount) 98 .append(",cacheMissCount=").append(this.cacheMissCount) 99 .append(",cachePutCount=").append(this.cachePutCount) 100 .append(",executionCount=").append(this.executionCount) 101 .append(",executionRowCount=").append(this.executionRowCount) 102 .append(",executionAvgTime=").append(this.executionAvgTime) 103 .append(",executionMaxTime=").append(this.executionMaxTime) 104 .append(",executionMinTime=").append(this.executionMinTime) 105 .append(']') 106 .toString(); 107 } 108 109 } 110 | Popular Tags |