SimpleCacheStatistics Class Reference

#include <coherence/net/cache/SimpleCacheStatistics.hpp>

Inherits Object, and CacheStatistics.

List of all members.


Detailed Description

Implementation of the CacheStatistics class intended for use by a cache to maintain its statistics.

Author:
tb 2008.06.12

Public Types

typedef spec::Handle Handle
 SimpleCacheStatistics Handle definition.
typedef spec::View View
 SimpleCacheStatistics View definition.
typedef spec::Holder Holder
 SimpleCacheStatistics Holder definition.

Public Member Functions

virtual int64_t getTotalGets () const
 Determine the total number of get() operations since the cache statistics were last reset.

Returns:
the total number of get() operations

virtual int64_t getTotalGetsMillis () const
 Determine the total number of milliseconds spent on get() operations since the cache statistics were last reset.

Returns:
the total number of milliseconds processing get() operations

virtual float64_t getAverageGetMillis () const
 Determine the average number of milliseconds per get() invocation since the cache statistics were last reset.

Returns:
the average number of milliseconds per get() operation

virtual int64_t getTotalPuts () const
 Determine the total number of put() operations since the cache statistics were last reset.

Returns:
the total number of put() operations

virtual int64_t getTotalPutsMillis () const
 Determine the total number of milliseconds spent on put() operations since the cache statistics were last reset.

Returns:
the total number of milliseconds processing put() operations

virtual float64_t getAveragePutMillis () const
 Determine the average number of milliseconds per put() invocation since the cache statistics were last reset.

Returns:
the average number of milliseconds per put() operation

virtual int64_t getCacheHits () const
 Determine the rough number of cache hits since the cache statistics were last reset.

A cache hit is a read operation invocation (i.e. get()) for which an entry exists in this map.

Returns:
the number of get() calls that have been served by existing cache entries

virtual int64_t getCacheHitsMillis () const
 Determine the total number of milliseconds (since that last statistics reset) for the get() operations for which an entry existed in this map.

Returns:
the total number of milliseconds for the get() operations that were hits

virtual float64_t getAverageHitMillis () const
 Determine the average number of milliseconds per get() invocation that is a hit.

Returns:
the average number of milliseconds per cache hit

virtual int64_t getCacheMisses () const
 Determine the rough number of cache misses since the cache statistics were last reset.

A cache miss is a get() invocation that does not have an entry in this map.

Returns:
the number of get() calls that failed to find an existing cache entry because the requested key was not in the cache

virtual int64_t getCacheMissesMillis () const
 Determine the total number of milliseconds (since that last statistics reset) for the get() operations for which no entry existed in this map.

Returns:
the total number of milliseconds (since that last statistics reset) for the get() operations that were misses

virtual float64_t getAverageMissMillis () const
 Determine the average number of milliseconds per get() invocation that is a miss.

Returns:
the average number of milliseconds per cache miss

virtual float64_t getHitProbability () const
 Determine the rough probability (0 <= p <= 1) that the next invocation will be a hit, based on the statistics collected since the last reset of the cache statistics.

Returns:
the cache hit probability (0 <= p <= 1)

virtual void resetHitStatistics ()
 Reset the cache statistics.
virtual void registerHit ()
 Register a cache hit (no timing information).
virtual void registerHit (int64_t lStartMillis)
 Register a cache hit.
virtual void registerHits (int32_t cHits, int64_t lStartMillis)
 Register a multiple cache hit.
virtual void registerMiss ()
 Register a cache miss (no timing information).
virtual void registerMiss (int64_t lStartMillis)
 Register a cache miss.
virtual void registerMisses (int32_t cMisses, int64_t lStartMillis)
 Register a multiple cache miss.
virtual void registerPut (int64_t lStartMillis)
 Register a cache put.
virtual void registerPuts (int32_t cPuts, int64_t lStartMillis)
 Register a multiple cache put.
void toStream (std::ostream &out) const
 Output a human-readable description of this Object to the given stream.

coherence::lang::operator<<(std::ostream, Object::View) is defined and will call into the toStream method, to output Objects. If a manged String object is desired, the COH_TO_STRING macro can be used to build up a String from streamable contents.

 Object::View vKey   = ...
 Object::View vValue = ...
 std::cout << vKey << " = " << vValue << std::endl;

 String::Handle hs = COH_TO_STRING(vKey << " = " << vValue);

Parameters:
out the stream used to output the description


Protected Member Functions

 SimpleCacheStatistics ()
 Create a SimpleCacheStatistics object.

Protected Attributes

Volatile< int64_t > m_cCacheHits
 The rough (ie unsynchronized) number of calls that could be answered from the front or the back and were answered by data in the front map.
Volatile< int64_t > m_cCacheMisses
 The rough (ie unsynchronized) number of calls that could be answered from the front or the back and were answered by data in the back map.
Volatile< int64_t > m_cHitsMillis
 Total number of milliseconds used for get operations that were hits since the last statistics reset.
Volatile< int64_t > m_cMissesMillis
 Total number of milliseconds used for get operations that were misses since the last statistics reset.
Volatile< int64_t > m_cCachePuts
 Total number of put operations since the last statistics reset.
Volatile< int64_t > m_cPutsMillis
 Total number of milliseconds used for put operations since the last statistics reset.

Member Function Documentation

virtual void registerHit ( int64_t  lStartMillis  )  [virtual]

Register a cache hit.

Parameters:
lStartMillis the time when the get operation started

virtual void registerHits ( int32_t  cHits,
int64_t  lStartMillis 
) [virtual]

Register a multiple cache hit.

Parameters:
cHits the number of hits
lStartMillis the time when the get operation started

virtual void registerMiss ( int64_t  lStartMillis  )  [virtual]

Register a cache miss.

Parameters:
lStartMillis the time when the get operation started

virtual void registerMisses ( int32_t  cMisses,
int64_t  lStartMillis 
) [virtual]

Register a multiple cache miss.

Parameters:
cMisses the number of misses
lStartMillis the time when the get operation started

virtual void registerPut ( int64_t  lStartMillis  )  [virtual]

Register a cache put.

Parameters:
lStartMillis the time when the put operation started

virtual void registerPuts ( int32_t  cPuts,
int64_t  lStartMillis 
) [virtual]

Register a multiple cache put.

Parameters:
cPuts the number of puts
lStartMillis the time when the put operation started


The documentation for this class was generated from the following file: Copyright (c) 2000-2008 Oracle. All rights reserved.