C++ Client API Reference for Oracle Coherence
14c (14.1.2.0.0)

F79659-03

coherence/net/cache/CacheStatistics.hpp

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