00001 /* 00002 * CacheStatistics.hpp 00003 * 00004 * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. 00005 * 00006 * Oracle is a registered trademarks of Oracle Corporation and/or its 00007 * affiliates. 00008 * 00009 * This software is the confidential and proprietary information of Oracle 00010 * Corporation. You shall not disclose such confidential and proprietary 00011 * information and shall use it only in accordance with the terms of the 00012 * license agreement you entered into with Oracle. 00013 * 00014 * This notice may not be removed or altered. 00015 */ 00016 #ifndef COH_CACHE_STATISTICS_HPP 00017 #define COH_CACHE_STATISTICS_HPP 00018 00019 #include "coherence/lang.ns" 00020 00021 COH_OPEN_NAMESPACE3(coherence,net,cache) 00022 00023 00024 /** 00025 * An interface for exposing Cache statistics. 00026 * 00027 * @author tb 2008.06.12 00028 */ 00029 class COH_EXPORT CacheStatistics 00030 : public interface_spec<CacheStatistics> 00031 { 00032 // ----- CacheStatistics interface -------------------------------------- 00033 00034 public: 00035 /** 00036 * Determine the total number of get() operations since the cache 00037 * statistics were last reset. 00038 * 00039 * @return the total number of get() operations 00040 */ 00041 virtual int64_t getTotalGets() const = 0; 00042 00043 /** 00044 * Determine the total number of milliseconds spent on get() 00045 * operations since the cache statistics were last reset. 00046 * 00047 * @return the total number of milliseconds processing get() 00048 * operations 00049 */ 00050 virtual int64_t getTotalGetsMillis() const = 0; 00051 00052 /** 00053 * Determine the average number of milliseconds per get() invocation 00054 * since the cache statistics were last reset. 00055 * 00056 * @return the average number of milliseconds per get() operation 00057 */ 00058 virtual float64_t getAverageGetMillis() const = 0; 00059 00060 /** 00061 * Determine the total number of put() operations since the cache 00062 * statistics were last reset. 00063 * 00064 * @return the total number of put() operations 00065 */ 00066 virtual int64_t getTotalPuts() const = 0; 00067 00068 /** 00069 * Determine the total number of milliseconds spent on put() 00070 * operations since the cache statistics were last reset. 00071 * 00072 * @return the total number of milliseconds processing put() 00073 * operations 00074 */ 00075 virtual int64_t getTotalPutsMillis() const = 0; 00076 00077 /** 00078 * Determine the average number of milliseconds per put() invocation 00079 * since the cache statistics were last reset. 00080 * 00081 * @return the average number of milliseconds per put() operation 00082 */ 00083 virtual float64_t getAveragePutMillis() const = 0; 00084 00085 /** 00086 * Determine the rough number of cache hits since the cache statistics 00087 * were last reset. 00088 * 00089 * A cache hit is a read operation invocation (i.e. get()) for which 00090 * an entry exists in this map. 00091 * 00092 * @return the number of get() calls that have been served by 00093 * existing cache entries 00094 */ 00095 virtual int64_t getCacheHits() const = 0; 00096 00097 /** 00098 * Determine the total number of milliseconds (since that last 00099 * statistics reset) for the get() operations for which an entry 00100 * existed in this map. 00101 * 00102 * @return the total number of milliseconds for the get() operations 00103 * that were hits 00104 */ 00105 virtual int64_t getCacheHitsMillis() const = 0; 00106 00107 /** 00108 * Determine the average number of milliseconds per get() invocation 00109 * that is a hit. 00110 * 00111 * @return the average number of milliseconds per cache hit 00112 */ 00113 virtual float64_t getAverageHitMillis() const = 0; 00114 00115 /** 00116 * Determine the rough number of cache misses since the cache 00117 * statistics were last reset. 00118 * 00119 * A cache miss is a get() invocation that does not have an entry in 00120 * this map. 00121 * 00122 * @return the number of get() calls that failed to find an existing 00123 * cache entry because the requested key was not in the cache 00124 */ 00125 virtual int64_t getCacheMisses() const = 0; 00126 00127 /** 00128 * Determine the total number of milliseconds (since that last 00129 * statistics reset) for the get() operations for which no entry 00130 * existed in this map. 00131 * 00132 * @return the total number of milliseconds (since that last 00133 * statistics reset) for the get() operations that were misses 00134 */ 00135 virtual int64_t getCacheMissesMillis() const = 0; 00136 00137 /** 00138 * Determine the average number of milliseconds per get() invocation 00139 * that is a miss. 00140 * 00141 * @return the average number of milliseconds per cache miss 00142 */ 00143 virtual float64_t getAverageMissMillis() const = 0; 00144 00145 /** 00146 * Determine the rough probability (0 <= p <= 1) that the next 00147 * invocation will be a hit, based on the statistics collected since 00148 * the last reset of the cache statistics. 00149 * 00150 * @return the cache hit probability (0 <= p <= 1) 00151 */ 00152 virtual float64_t getHitProbability() const = 0; 00153 00154 /** 00155 * Determine the rough number of cache pruning cycles since the cache 00156 * statistics were last reset. 00157 * 00158 * For the LocalCache implementation, this refers to the number of 00159 * times that the <tt>prune()</tt> method is executed. 00160 * 00161 * @return the total number of cache pruning cycles (since that last 00162 * statistics reset) 00163 */ 00164 virtual int64_t getCachePrunes() const = 0; 00165 00166 /** 00167 * Determine the total number of milliseconds (since that last 00168 * statistics reset) spent on cache pruning. 00169 * 00170 * For the LocalCache implementation, this refers to the time spent in 00171 * the <tt>prune()</tt> method. 00172 * 00173 * @return the total number of milliseconds (since that last statistics 00174 * reset) for cache pruning operations 00175 */ 00176 virtual int64_t getCachePrunesMillis() const = 0; 00177 00178 /** 00179 * Determine the average number of milliseconds per cache pruning. 00180 * 00181 * @return the average number of milliseconds per cache pruning 00182 */ 00183 virtual float64_t getAveragePruneMillis() const = 0; 00184 00185 /** 00186 * Reset the cache statistics. 00187 */ 00188 virtual void resetHitStatistics() = 0; 00189 }; 00190 00191 COH_CLOSE_NAMESPACE3 00192 00193 #endif // COH_CACHE_STATISTICS_HPP