Oracle Coherence for C++ API
Release 3.6.0.0
E15728-01

- Main Page
- Namespaces
- Classes
- Files

# coherence/net/cache/SimpleCacheStatistics.hpp

    00001 /*
    00002 * SimpleCacheStatistics.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_SIMPLE_CACHE_STATISTICS_HPP
    00017 #define COH_SIMPLE_CACHE_STATISTICS_HPP
    00018
    00019 #include "coherence/lang.ns"
    00020
    00021 #include "coherence/net/cache/CacheStatistics.hpp"
    00022
    00023 #include <ostream>
    00024
    00025 COH_OPEN_NAMESPACE3(coherence,net,cache)
    00026
    00027
    00028 /**
    00029 * Implementation of the CacheStatistics class intended for use by a cache
    00030 * to maintain its statistics.
    00031 *
    00032 * @author tb  2008.06.12
    00033 */
    00034 class COH_EXPORT SimpleCacheStatistics
    00035     : public class_spec<SimpleCacheStatistics,
    00036         extends<Object>,
    00037         implements<CacheStatistics> >
    00038     {
    00039     friend class factory<SimpleCacheStatistics>;
    00040
    00041     // ----- constructors ---------------------------------------------------
    00042
    00043     protected:
    00044         /**
    00045         * Create a SimpleCacheStatistics object.
    00046         */
    00047         SimpleCacheStatistics();
    00048
    00049
    00050     // ----- CacheStatistics interface --------------------------------------
    00051
    00052     public:
    00053         /**
    00054         * {@inheritDoc}
    00055         */
    00056         virtual int64_t getTotalGets() const;
    00057
    00058         /**
    00059         * {@inheritDoc}
    00060         */
    00061         virtual int64_t getTotalGetsMillis() const;
    00062
    00063         /**
    00064         * {@inheritDoc}
    00065         */
    00066         virtual float64_t getAverageGetMillis() const;
    00067
    00068         /**
    00069         * {@inheritDoc}
    00070         */
    00071         virtual int64_t getTotalPuts() const;
    00072
    00073         /**
    00074         * {@inheritDoc}
    00075         */
    00076         virtual int64_t getTotalPutsMillis() const;
    00077
    00078         /**
    00079         * {@inheritDoc}
    00080         */
    00081         virtual float64_t getAveragePutMillis() const;
    00082
    00083         /**
    00084         * {@inheritDoc}
    00085         */
    00086         virtual int64_t getCacheHits() const;
    00087
    00088         /**
    00089         * {@inheritDoc}
    00090         */
    00091         virtual int64_t getCacheHitsMillis() const;
    00092
    00093         /**
    00094         * {@inheritDoc}
    00095         */
    00096         virtual float64_t getAverageHitMillis() const;
    00097
    00098         /**
    00099         * {@inheritDoc}
    00100         */
    00101         virtual int64_t getCacheMisses() const;
    00102
    00103         /**
    00104         * {@inheritDoc}
    00105         */
    00106         virtual int64_t getCacheMissesMillis() const;
    00107
    00108         /**
    00109         * {@inheritDoc}
    00110         */
    00111         virtual float64_t getAverageMissMillis() const;
    00112
    00113         /**
    00114         * {@inheritDoc}
    00115         */
    00116         virtual float64_t getHitProbability() const;
    00117
    00118         /**
    00119         * {@inheritDoc}
    00120         */
    00121         virtual int64_t getCachePrunes() const;
    00122
    00123         /**
    00124         * {@inheritDoc}
    00125         */
    00126         virtual int64_t getCachePrunesMillis() const;
    00127
    00128         /**
    00129         * {@inheritDoc}
    00130         */
    00131         virtual float64_t getAveragePruneMillis() const;
    00132
    00133         /**
    00134         * {@inheritDoc}
    00135         */
    00136         virtual void resetHitStatistics();
    00137
    00138
    00139     // ----- accessors, mutators and helpers --------------------------------
    00140
    00141     public:
    00142         /**
    00143         * Register a cache hit (no timing information).
    00144         */
    00145         virtual void registerHit();
    00146
    00147         /**
    00148         * Register a cache hit.
    00149         *
    00150         * @param lStartMillis  the time when the get operation started
    00151         */
    00152         virtual void registerHit(int64_t lStartMillis);
    00153
    00154         /**
    00155         * Register a multiple cache hit.
    00156         *
    00157         * @param cHits         the number of hits
    00158         * @param lStartMillis  the time when the get operation started
    00159         */
    00160         virtual void registerHits(int32_t cHits, int64_t lStartMillis);
    00161
    00162         /**
    00163         * Register a cache miss (no timing information).
    00164         */
    00165         virtual void registerMiss();
    00166
    00167         /**
    00168         * Register a cache miss.
    00169         *
    00170         * @param lStartMillis  the time when the get operation started
    00171         */
    00172         virtual void registerMiss(int64_t lStartMillis);
    00173
    00174         /**
    00175         * Register a multiple cache miss.
    00176         *
    00177         * @param cMisses       the number of misses
    00178         * @param lStartMillis  the time when the get operation started
    00179         */
    00180         virtual void registerMisses(int32_t cMisses, int64_t lStartMillis);
    00181
    00182         /**
    00183         * Register a cache put.
    00184         *
    00185         * @param lStartMillis  the time when the put operation started
    00186         */
    00187         virtual void registerPut(int64_t lStartMillis);
    00188
    00189         /**
    00190         * Register a multiple cache put.
    00191         *
    00192         * @param cPuts         the number of puts
    00193         * @param lStartMillis  the time when the put operation started
    00194         */
    00195         virtual void registerPuts(int32_t cPuts, int64_t lStartMillis);
    00196
    00197         /**
    00198         * Register a cache prune.
    00199         *
    00200         * @param lStartMillis  the time when the prune operation started
    00201         */
    00202         virtual void registerCachePrune(int64_t lStartMillis);
    00203
    00204
    00205     // ----- Object interface -----------------------------------------------
    00206
    00207     public:
    00208         /**
    00209         * {@inheritDoc}
    00210         */
    00211         void toStream(std::ostream& out) const;
    00212
    00213
    00214     // ----- data members ---------------------------------------------------
    00215
    00216     protected:
    00217         /**
    00218         * The rough (ie unsynchronized) number of calls that could be
    00219         * answered from the front or the back and were answered by data in
    00220         * the front map.
    00221         */
    00222         /*volatile stat*/ int64_t m_cCacheHits;
    00223
    00224         /**
    00225         * The rough (ie unsynchronized) number of calls that could be
    00226         * answered from the front or the back and were answered by data in
    00227         * the back map.
    00228         */
    00229         /*volatile stat*/ int64_t m_cCacheMisses;
    00230
    00231         /**
    00232         * Total number of milliseconds used for get operations that were hits
    00233         * since the last statistics reset.
    00234         */
    00235         /*volatile stat*/ int64_t m_cHitsMillis;
    00236
    00237         /**
    00238         * Total number of milliseconds used for get operations that were
    00239         * misses since the last statistics reset.
    00240         */
    00241         /*volatile stat*/ int64_t m_cMissesMillis;
    00242
    00243         /**
    00244         * Total number of put operations since the last statistics reset.
    00245         */
    00246         /*volatile stat*/ int64_t m_cCachePuts;
    00247
    00248         /**
    00249         * Total number of milliseconds used for put operations since the last
    00250         * statistics reset.
    00251         */
    00252         /*volatile stat*/ int64_t m_cPutsMillis;
    00253
    00254         /**
    00255         * Total number of evictions triggered based on the size of the cache
    00256         * since the last statistics reset.
    00257         */
    00258         /*volatile stat*/ int64_t m_cCachePrunes;
    00259
    00260         /**
    00261         * Total number of milliseconds used for prune operations since the
    00262         * last statistics reset.
    00263         */
    00264         /*volatile stat*/ int64_t m_cCachePrunesMillis;
    00265
    00266     };
    00267
    00268 COH_CLOSE_NAMESPACE3
    00269
    00270 #endif // COH_SIMPLE_CACHE_STATISTICS_HPP

Copyright © 2000, 2010, Oracle and/or its affiliates. All rights reserved.