static class WindowCache.StatsRecorderImpl extends java.lang.Object implements WindowCache.StatsRecorder, WindowCacheStats
Modifier and Type | Field and Description |
---|---|
private java.util.concurrent.atomic.LongAdder |
evictionCount |
private java.util.concurrent.atomic.LongAdder |
hitCount |
private java.util.concurrent.atomic.LongAdder |
loadFailureCount |
private java.util.concurrent.atomic.LongAdder |
loadSuccessCount |
private java.util.concurrent.atomic.LongAdder |
missCount |
private java.util.concurrent.atomic.LongAdder |
openByteCount |
private java.util.Map<java.lang.String,java.util.concurrent.atomic.LongAdder> |
openByteCountPerRepository |
private java.util.concurrent.atomic.LongAdder |
openFileCount |
private java.util.concurrent.atomic.LongAdder |
totalLoadTime |
Constructor and Description |
---|
StatsRecorderImpl()
Constructs an instance with all counts initialized to zero.
|
Modifier and Type | Method and Description |
---|---|
long |
getEvictionCount()
Number of cache evictions
|
long |
getHitCount()
Number of cache hits
|
long |
getLoadFailureCount()
Number of failed loads
|
long |
getLoadSuccessCount()
Number of successful loads
|
long |
getMissCount()
Number of cache misses.
|
long |
getOpenByteCount()
Number of bytes cached
|
java.util.Map<java.lang.String,java.lang.Long> |
getOpenByteCountPerRepository()
Number of bytes cached per repository
|
long |
getOpenFileCount()
Number of pack files kept open by the cache
|
WindowCacheStats |
getStats()
Returns a snapshot of this recorder's stats.
|
long |
getTotalLoadTime()
Total time in nanoseconds the cache spent loading new values.
|
void |
recordEvictions(int count)
Record cache evictions due to the cache evictions strategy
|
void |
recordHits(int count)
Record cache hits.
|
void |
recordLoadFailure(long loadTimeNanos)
Record a failed load of a cache entry
|
void |
recordLoadSuccess(long loadTimeNanos)
Record a successful load of a cache entry
|
void |
recordMisses(int count)
Record cache misses.
|
void |
recordOpenBytes(PackFile pack,
int delta)
Record cached bytes
|
void |
recordOpenFiles(int delta)
Record files opened by cache
|
private static java.lang.String |
repositoryId(PackFile pack) |
void |
resetCounters()
Reset counters.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getAverageLoadTime, getEvictionRatio, getHitRatio, getLoadCount, getLoadFailureRatio, getMissRatio, getOpenBytes, getOpenFiles, getRequestCount, getStats
private final java.util.concurrent.atomic.LongAdder hitCount
private final java.util.concurrent.atomic.LongAdder missCount
private final java.util.concurrent.atomic.LongAdder loadSuccessCount
private final java.util.concurrent.atomic.LongAdder loadFailureCount
private final java.util.concurrent.atomic.LongAdder totalLoadTime
private final java.util.concurrent.atomic.LongAdder evictionCount
private final java.util.concurrent.atomic.LongAdder openFileCount
private final java.util.concurrent.atomic.LongAdder openByteCount
private final java.util.Map<java.lang.String,java.util.concurrent.atomic.LongAdder> openByteCountPerRepository
public StatsRecorderImpl()
public void recordHits(int count)
WindowCache.StatsRecorder
recordHits
in interface WindowCache.StatsRecorder
count
- number of cache hits to recordpublic void recordMisses(int count)
WindowCache.StatsRecorder
recordMisses
in interface WindowCache.StatsRecorder
count
- number of cache misses to recordpublic void recordLoadSuccess(long loadTimeNanos)
WindowCache.StatsRecorder
recordLoadSuccess
in interface WindowCache.StatsRecorder
loadTimeNanos
- time to load a cache entrypublic void recordLoadFailure(long loadTimeNanos)
WindowCache.StatsRecorder
recordLoadFailure
in interface WindowCache.StatsRecorder
loadTimeNanos
- time used trying to load a cache entrypublic void recordEvictions(int count)
WindowCache.StatsRecorder
recordEvictions
in interface WindowCache.StatsRecorder
count
- number of evictions to recordpublic void recordOpenFiles(int delta)
WindowCache.StatsRecorder
recordOpenFiles
in interface WindowCache.StatsRecorder
delta
- delta of number of files opened by cachepublic void recordOpenBytes(PackFile pack, int delta)
WindowCache.StatsRecorder
recordOpenBytes
in interface WindowCache.StatsRecorder
pack
- pack file the bytes are read fromdelta
- delta of cached bytesprivate static java.lang.String repositoryId(PackFile pack)
public WindowCacheStats getStats()
WindowCache.StatsRecorder
getStats
in interface WindowCache.StatsRecorder
public long getHitCount()
WindowCacheStats
getHitCount
in interface WindowCacheStats
public long getMissCount()
WindowCacheStats
getMissCount
in interface WindowCacheStats
public long getLoadSuccessCount()
WindowCacheStats
getLoadSuccessCount
in interface WindowCacheStats
public long getLoadFailureCount()
WindowCacheStats
getLoadFailureCount
in interface WindowCacheStats
public long getEvictionCount()
WindowCacheStats
getEvictionCount
in interface WindowCacheStats
public long getTotalLoadTime()
WindowCacheStats
getTotalLoadTime
in interface WindowCacheStats
public long getOpenFileCount()
WindowCacheStats
getOpenFileCount
in interface WindowCacheStats
public long getOpenByteCount()
WindowCacheStats
getOpenByteCount
in interface WindowCacheStats
public void resetCounters()
WindowCacheStats
resetCounters
in interface WindowCacheStats
public java.util.Map<java.lang.String,java.lang.Long> getOpenByteCountPerRepository()
WindowCacheStats
getOpenByteCountPerRepository
in interface WindowCacheStats