CoherenceTM v3.3
Copyright© 2000-2007 by Oracle Corporation

com.tangosol.net.cache
Class SimpleCacheStatistics

java.lang.Object
  extended by com.tangosol.util.Base
      extended by com.tangosol.net.cache.SimpleCacheStatistics
All Implemented Interfaces:
CacheStatistics, Serializable

public class SimpleCacheStatistics
extends Base
implements CacheStatistics, Serializable

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

Since:
Coherence 2.2
Author:
cp 2003.06.02

Field Summary
protected  long 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.
protected  long 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.
protected  long m_cCachePuts
          Total number of put operations since the last statistics reset.
protected  long m_cHitsMillis
          Total number of milliseconds used for get operations that were hits since the last statistics reset.
protected  long m_cMissesMillis
          Total number of milliseconds used for get operations that were misses since the last statistics reset.
protected  long m_cPutsMillis
          Total number of milliseconds used for put operations since the last statistics reset.
 
Constructor Summary
SimpleCacheStatistics()
          Default constructor.
 
Method Summary
 double getAverageGetMillis()
          Determine the average number of milliseconds per get() invocation since the cache statistics were last reset.
 double getAverageHitMillis()
          Determine the average number of milliseconds per get() invocation that is a hit (answered using only the front map).
 double getAverageMissMillis()
          Determine the average number of milliseconds per get() invocation that is a miss (uses the back map).
 double getAveragePutMillis()
          Determine the average number of milliseconds per put() invocation since the cache statistics were last reset.
 long getCacheHits()
          Determine the rough number of cache hits since the cache statistics were last reset.
 long getCacheHitsMillis()
          Determine the total number of milliseconds (since that last statistics reset) for the get() operations for which an entry existed in this map.
 long getCacheMisses()
          Determine the rough number of cache misses since the cache statistics were last reset.
 long getCacheMissesMillis()
          Determine the total number of milliseconds (since that last statistics reset) for the get() operations for which no entry existed in this map.
 double getHitProbability()
          Determine the rough probability (0 <= p <= 1) that any particular invocation that could be answered using the front or the back will be handled by the front map, based on the statistics collected since the last reset of the cache statistics.
 long getTotalGets()
          Determine the total number of get() operations since the cache statistics were last reset.
 long getTotalGetsMillis()
          Determine the total number of milliseconds spent on get() operations since the cache statistics were last reset.
 long getTotalPuts()
          Determine the total number of put() operations since the cache statistics were last reset.
 long getTotalPutsMillis()
          Determine the total number of milliseconds spent on put() operations since the cache statistics were last reset.
 void registerHit()
          Register a cache hit (no timing information).
 void registerHit(long lStartMillis)
          Register a cache hit.
 void registerHits(int cHits, long lStartMillis)
          Register a multiple cache hit.
 void registerMiss()
          Register a cache miss (no timing information).
 void registerMiss(long lStartMillis)
          Register a cache miss.
 void registerMisses(int cMisses, long lStartMillis)
          Register a multiple cache miss.
 void registerPut(long lStartMillis)
          Register a cache put.
 void registerPuts(int cPuts, long lStartMillis)
          Register a multiple cache put.
 void resetHitStatistics()
          Reset the cache statistics.
 String toString()
          For debugging purposes, format the contents of the SimpleCachingStatistics in a human readable format.
 

Field Detail

m_cCacheHits

protected volatile long 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.


m_cCacheMisses

protected volatile long 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.


m_cHitsMillis

protected volatile long m_cHitsMillis
Total number of milliseconds used for get operations that were hits since the last statistics reset.


m_cMissesMillis

protected volatile long m_cMissesMillis
Total number of milliseconds used for get operations that were misses since the last statistics reset.


m_cCachePuts

protected volatile long m_cCachePuts
Total number of put operations since the last statistics reset.


m_cPutsMillis

protected volatile long m_cPutsMillis
Total number of milliseconds used for put operations since the last statistics reset.

Constructor Detail

SimpleCacheStatistics

public SimpleCacheStatistics()
Default constructor.

Method Detail

getTotalGets

public long getTotalGets()
Determine the total number of get() operations since the cache statistics were last reset.

Specified by:
getTotalGets in interface CacheStatistics
Returns:
the total number of get() operations

getTotalGetsMillis

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

Specified by:
getTotalGetsMillis in interface CacheStatistics
Returns:
the total number of milliseconds processing get() operations

getAverageGetMillis

public double getAverageGetMillis()
Determine the average number of milliseconds per get() invocation since the cache statistics were last reset.

Specified by:
getAverageGetMillis in interface CacheStatistics
Returns:
the average number of milliseconds per get() operation

getTotalPuts

public long getTotalPuts()
Determine the total number of put() operations since the cache statistics were last reset.

Specified by:
getTotalPuts in interface CacheStatistics
Returns:
the total number of put() operations

getTotalPutsMillis

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

Specified by:
getTotalPutsMillis in interface CacheStatistics
Returns:
the total number of milliseconds processing put() operations

getAveragePutMillis

public double getAveragePutMillis()
Determine the average number of milliseconds per put() invocation since the cache statistics were last reset.

Specified by:
getAveragePutMillis in interface CacheStatistics
Returns:
the average number of milliseconds per put() operation

getCacheHits

public long getCacheHits()
Determine the rough number of cache hits since the cache statistics were last reset. A cache hit is an invocation that could be answered from the front or the back and is answered by data in the front map.

Specified by:
getCacheHits in interface CacheStatistics
Returns:
the number of get() calls that have been served by existing cache entries

getCacheHitsMillis

public long getCacheHitsMillis()
Description copied from interface: CacheStatistics
Determine the total number of milliseconds (since that last statistics reset) for the get() operations for which an entry existed in this map.

Specified by:
getCacheHitsMillis in interface CacheStatistics
Returns:
the total number of milliseconds (since that last statistics reset) for the get() operations that were answered by the front map

getAverageHitMillis

public double getAverageHitMillis()
Determine the average number of milliseconds per get() invocation that is a hit (answered using only the front map).

Specified by:
getAverageHitMillis in interface CacheStatistics
Returns:
the average number of milliseconds per cache hit

getCacheMisses

public long getCacheMisses()
Determine the rough number of cache misses since the cache statistics were last reset. A cache miss is an invocation that could be answered from the front or the back and is answered by data in the back map because the data is not in the front map.

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

getCacheMissesMillis

public long getCacheMissesMillis()
Description copied from interface: CacheStatistics
Determine the total number of milliseconds (since that last statistics reset) for the get() operations for which no entry existed in this map.

Specified by:
getCacheMissesMillis in interface CacheStatistics
Returns:
the total number of milliseconds (since that last statistics reset) for the get() operations that went to the back map

getAverageMissMillis

public double getAverageMissMillis()
Determine the average number of milliseconds per get() invocation that is a miss (uses the back map).

Specified by:
getAverageMissMillis in interface CacheStatistics
Returns:
the average number of milliseconds per cache miss

getHitProbability

public double getHitProbability()
Determine the rough probability (0 <= p <= 1) that any particular invocation that could be answered using the front or the back will be handled by the front map, based on the statistics collected since the last reset of the cache statistics.

Specified by:
getHitProbability in interface CacheStatistics
Returns:
the cache hit probability (0 <= p <= 1)

resetHitStatistics

public void resetHitStatistics()
Reset the cache statistics.

Specified by:
resetHitStatistics in interface CacheStatistics

toString

public String toString()
For debugging purposes, format the contents of the SimpleCachingStatistics in a human readable format.

Returns:
a String representation of this object

registerHit

public void registerHit()
Register a cache hit (no timing information).


registerHit

public void registerHit(long lStartMillis)
Register a cache hit.

Parameters:
lStartMillis - the time when the get operation started

registerHits

public void registerHits(int cHits,
                         long lStartMillis)
Register a multiple cache hit.

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

registerMiss

public void registerMiss()
Register a cache miss (no timing information).


registerMiss

public void registerMiss(long lStartMillis)
Register a cache miss.

Parameters:
lStartMillis - the time when the get operation started

registerMisses

public void registerMisses(int cMisses,
                           long lStartMillis)
Register a multiple cache miss.

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

registerPut

public void registerPut(long lStartMillis)
Register a cache put.

Parameters:
lStartMillis - the time when the put operation started

registerPuts

public void registerPuts(int cPuts,
                         long lStartMillis)
Register a multiple cache put.

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

CoherenceTM v3.3
Copyright© 2000-2007 by Oracle Corporation