Package com.tangosol.net.cache
Class SimpleCacheStatistics
java.lang.Object
com.tangosol.util.Base
com.tangosol.net.cache.SimpleCacheStatistics
- All Implemented Interfaces:
CacheStatistics
,Serializable
Implementation of the CacheStatistics interface intended for use by a cache
to maintain its statistics.
- Since:
- Coherence 2.2
- Author:
- cp 2003.06.02
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.tangosol.util.Base
Base.LoggingWriter
-
Field Summary
Modifier and TypeFieldDescriptionprotected long
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
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
Total number of evictions triggered based on the size of the cache since the last statistics reset.protected long
Total number of milliseconds used for prune operations since the last statistics reset.protected long
Total number of put operations since the last statistics reset.protected long
Total number of milliseconds used for get operations that were hits since the last statistics reset.protected long
Total number of milliseconds used for get operations that were misses since the last statistics reset.protected long
Total number of milliseconds used for put operations since the last statistics reset. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiondouble
Determine the average number of milliseconds per get() invocation since the cache statistics were last reset.double
Determine the average number of milliseconds per get() invocation that is a hit.double
Determine the average number of milliseconds per get() invocation that is a miss.double
Calculate the average number of milliseconds that a prune takes.double
Determine the average number of milliseconds per put() invocation since the cache statistics were last reset.long
Determine the rough number of cache hits since the cache statistics were last reset.long
Determine the total number of milliseconds (since the last statistics reset) for the get() operations for which an entry existed in this map.long
Determine the rough number of cache misses since the cache statistics were last reset.long
Determine the total number of milliseconds (since the last statistics reset) for the get() operations for which no entry existed in this map.long
Determine the rough number of cache pruning cycles since the cache statistics were last reset.long
Determine the total number of milliseconds (since the last statistics reset) spent on cache pruning.double
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.long
Determine the total number of get() operations since the cache statistics were last reset.long
Determine the total number of milliseconds spent on get() operations since the cache statistics were last reset.long
Determine the total number of put() operations since the cache statistics were last reset.long
Determine the total number of milliseconds spent on put() operations since the cache statistics were last reset.void
registerCachePrune
(long lStartMillis) Register a cache prune.void
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
registerIncrementalCachePrune
(long lStartMillis) Register an incremental cache prune, which is to say that the time is accreted but the number of prunes does not increase.void
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
Reset all of the cache statistics.toString()
For debugging purposes, format the contents of the SimpleCachingStatistics in a human readable format.Methods inherited from class com.tangosol.util.Base
azzert, azzert, azzert, azzertFailed, breakLines, breakLines, capitalize, checkNotEmpty, checkNotNull, checkRange, computeSafeWaitTime, decimalValue, dup, dup, ensureBigDecimal, ensureClassLoader, ensureRuntimeException, ensureRuntimeException, equals, equalsDeep, err, err, err, err, err, escape, formatDateTime, getCallerStackFrame, getCommonMonitor, getCommonMonitor, getCommonMonitor, getContextClassLoader, getContextClassLoader, getDeepMessage, getErr, getLastSafeTimeMillis, getLog, getMaxDecDigits, getMaxHexDigits, getOriginalException, getOut, getProcessRandom, getRandom, getRandomBinary, getRandomBinary, getRandomString, getSafeTimeMillis, getStackFrame, getStackFrames, getStackTrace, getStackTrace, getStackTrace, getThreadFactory, getTimeZone, getUpTimeMillis, hashCode, hexValue, indentString, indentString, isDecimal, isHex, isLogEcho, isOctal, log, log, log, log, log, makeInteger, makeLong, makeThread, mergeArray, mergeBooleanArray, mergeByteArray, mergeCharArray, mergeDoubleArray, mergeFloatArray, mergeIntArray, mergeLongArray, mod, mod, octalValue, out, out, out, out, out, pad, parseBandwidth, parseBandwidth, parseDelimitedString, parseHex, parseHex, parseMemorySize, parseMemorySize, parsePercentage, parseTime, parseTime, parseTimeNanos, parseTimeNanos, printStackTrace, randomize, randomize, randomize, randomize, read, read, read, read, read, read, read, replace, setErr, setLog, setLogEcho, setOut, sleep, toBandwidthString, toBandwidthString, toCharEscape, toCrc, toCrc, toCrc, toCrc, toCrc, toDecString, toDelimitedString, toDelimitedString, toDelimitedString, toDelimitedString, toHex, toHex, toHexDump, toHexEscape, toHexEscape, toHexEscape, toHexEscape, toHexString, toMemorySizeString, toMemorySizeString, toQuotedCharEscape, toQuotedStringEscape, toSqlString, toString, toString, toStringEscape, toUnicodeEscape, trace, trace, trace, trace, trace, trace, trace, trace, trace, truncateString, truncateString, wait
-
Field Details
-
m_cCacheHits
protected volatile long m_cCacheHitsThe 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_cHitsMillis
protected volatile long m_cHitsMillisTotal number of milliseconds used for get operations that were hits since the last statistics reset. -
m_cCacheMisses
protected volatile long m_cCacheMissesThe 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_cMissesMillis
protected volatile long m_cMissesMillisTotal number of milliseconds used for get operations that were misses since the last statistics reset. -
m_cCachePuts
protected volatile long m_cCachePutsTotal number of put operations since the last statistics reset. -
m_cPutsMillis
protected volatile long m_cPutsMillisTotal number of milliseconds used for put operations since the last statistics reset. -
m_cCachePrunes
protected volatile long m_cCachePrunesTotal number of evictions triggered based on the size of the cache since the last statistics reset. -
m_cCachePrunesMillis
protected volatile long m_cCachePrunesMillisTotal number of milliseconds used for prune operations since the last statistics reset.
-
-
Constructor Details
-
SimpleCacheStatistics
public SimpleCacheStatistics()Default constructor.
-
-
Method Details
-
getTotalGets
public long getTotalGets()Determine the total number of get() operations since the cache statistics were last reset.- Specified by:
getTotalGets
in interfaceCacheStatistics
- 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 interfaceCacheStatistics
- 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 interfaceCacheStatistics
- 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 interfaceCacheStatistics
- 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 interfaceCacheStatistics
- 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 interfaceCacheStatistics
- 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 a read operation invocation (e.g. get()) for which an entry exists in this map.
- Specified by:
getCacheHits
in interfaceCacheStatistics
- Returns:
- the number of get() calls that have been served by existing cache entries
-
getCacheHitsMillis
public long getCacheHitsMillis()Determine the total number of milliseconds (since the last statistics reset) for the get() operations for which an entry existed in this map.- Specified by:
getCacheHitsMillis
in interfaceCacheStatistics
- Returns:
- the total number of milliseconds for the get() operations that were hits
-
getAverageHitMillis
public double getAverageHitMillis()Determine the average number of milliseconds per get() invocation that is a hit.- Specified by:
getAverageHitMillis
in interfaceCacheStatistics
- 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 a get() invocation that does not have an entry in this map.
- Specified by:
getCacheMisses
in interfaceCacheStatistics
- 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()Determine the total number of milliseconds (since the last statistics reset) for the get() operations for which no entry existed in this map.- Specified by:
getCacheMissesMillis
in interfaceCacheStatistics
- Returns:
- the total number of milliseconds (since the last statistics reset) for the get() operations that were misses
-
getAverageMissMillis
public double getAverageMissMillis()Determine the average number of milliseconds per get() invocation that is a miss.- Specified by:
getAverageMissMillis
in interfaceCacheStatistics
- Returns:
- the average number of milliseconds per cache miss
-
getHitProbability
public double getHitProbability()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.- Specified by:
getHitProbability
in interfaceCacheStatistics
- Returns:
- the cache hit probability (0 <= p <= 1)
-
getCachePrunes
public long getCachePrunes()Determine the rough number of cache pruning cycles since the cache statistics were last reset.For the LocalCache implementation, this refers to the number of times that the prune() method is executed.
- Specified by:
getCachePrunes
in interfaceCacheStatistics
- Returns:
- the total number of cache pruning cycles (since the last statistics reset)
-
getCachePrunesMillis
public long getCachePrunesMillis()Determine the total number of milliseconds (since the last statistics reset) spent on cache pruning.For the LocalCache implementation, this refers to the time spent in the prune() method.
- Specified by:
getCachePrunesMillis
in interfaceCacheStatistics
- Returns:
- the total number of milliseconds (since the last statistics reset) for cache pruning operations
-
getAveragePruneMillis
public double getAveragePruneMillis()Calculate the average number of milliseconds that a prune takes.- Returns:
- the average number of milliseconds spent per pruning cycle
-
resetHitStatistics
public void resetHitStatistics()Reset all of the cache statistics.Note that the method name implies that only the hit statistics are cleared, which is not the case; all of the statistics are cleared.
- Specified by:
resetHitStatistics
in interfaceCacheStatistics
-
toString
For debugging purposes, format the contents of the SimpleCachingStatistics in a human readable format. -
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 hitslStartMillis
- 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 misseslStartMillis
- 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 putslStartMillis
- the time when the put operation started
-
registerCachePrune
public void registerCachePrune(long lStartMillis) Register a cache prune.- Parameters:
lStartMillis
- the time when the prune operation started
-
registerIncrementalCachePrune
public void registerIncrementalCachePrune(long lStartMillis) Register an incremental cache prune, which is to say that the time is accreted but the number of prunes does not increase.- Parameters:
lStartMillis
- the time when the prune operation started- Since:
- Coherence 3.5
-