Class WindowCache.StatsRecorderImpl
- java.lang.Object
-
- org.eclipse.jgit.internal.storage.file.WindowCache.StatsRecorderImpl
-
- All Implemented Interfaces:
WindowCache.StatsRecorder,WindowCacheStats
- Enclosing class:
- WindowCache
static class WindowCache.StatsRecorderImpl extends java.lang.Object implements WindowCache.StatsRecorder, WindowCacheStats
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.concurrent.atomic.LongAdderevictionCountprivate java.util.concurrent.atomic.LongAdderhitCountprivate java.util.concurrent.atomic.LongAdderloadFailureCountprivate java.util.concurrent.atomic.LongAdderloadSuccessCountprivate java.util.concurrent.atomic.LongAddermissCountprivate java.util.concurrent.atomic.LongAdderopenByteCountprivate java.util.Map<java.lang.String,java.util.concurrent.atomic.LongAdder>openByteCountPerRepositoryprivate java.util.concurrent.atomic.LongAdderopenFileCountprivate java.util.concurrent.atomic.LongAddertotalLoadTime
-
Constructor Summary
Constructors Constructor Description StatsRecorderImpl()Constructs an instance with all counts initialized to zero.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description longgetEvictionCount()Number of cache evictionslonggetHitCount()Number of cache hitslonggetLoadFailureCount()Number of failed loadslonggetLoadSuccessCount()Number of successful loadslonggetMissCount()Number of cache misses.longgetOpenByteCount()Number of bytes cachedjava.util.Map<java.lang.String,java.lang.Long>getOpenByteCountPerRepository()Number of bytes cached per repositorylonggetOpenFileCount()Number of pack files kept open by the cacheWindowCacheStatsgetStats()Returns a snapshot of this recorder's stats.longgetTotalLoadTime()Total time in nanoseconds the cache spent loading new values.voidrecordEvictions(int count)Record cache evictions due to the cache evictions strategyvoidrecordHits(int count)Record cache hits.voidrecordLoadFailure(long loadTimeNanos)Record a failed load of a cache entryvoidrecordLoadSuccess(long loadTimeNanos)Record a successful load of a cache entryvoidrecordMisses(int count)Record cache misses.voidrecordOpenBytes(Pack pack, int delta)Record cached bytesvoidrecordOpenFiles(int delta)Record files opened by cacheprivate static java.lang.StringrepositoryId(Pack pack)voidresetCounters()Reset counters.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.eclipse.jgit.storage.file.WindowCacheStats
getAverageLoadTime, getEvictionRatio, getHitRatio, getLoadCount, getLoadFailureRatio, getMissRatio, getRequestCount
-
-
-
-
Field Detail
-
hitCount
private final java.util.concurrent.atomic.LongAdder hitCount
-
missCount
private final java.util.concurrent.atomic.LongAdder missCount
-
loadSuccessCount
private final java.util.concurrent.atomic.LongAdder loadSuccessCount
-
loadFailureCount
private final java.util.concurrent.atomic.LongAdder loadFailureCount
-
totalLoadTime
private final java.util.concurrent.atomic.LongAdder totalLoadTime
-
evictionCount
private final java.util.concurrent.atomic.LongAdder evictionCount
-
openFileCount
private final java.util.concurrent.atomic.LongAdder openFileCount
-
openByteCount
private final java.util.concurrent.atomic.LongAdder openByteCount
-
openByteCountPerRepository
private final java.util.Map<java.lang.String,java.util.concurrent.atomic.LongAdder> openByteCountPerRepository
-
-
Method Detail
-
recordHits
public void recordHits(int count)
Description copied from interface:WindowCache.StatsRecorderRecord cache hits. Called when cache returns a cached entry.- Specified by:
recordHitsin interfaceWindowCache.StatsRecorder- Parameters:
count- number of cache hits to record
-
recordMisses
public void recordMisses(int count)
Description copied from interface:WindowCache.StatsRecorderRecord cache misses. Called when the cache returns an entry which had to be loaded.- Specified by:
recordMissesin interfaceWindowCache.StatsRecorder- Parameters:
count- number of cache misses to record
-
recordLoadSuccess
public void recordLoadSuccess(long loadTimeNanos)
Description copied from interface:WindowCache.StatsRecorderRecord a successful load of a cache entry- Specified by:
recordLoadSuccessin interfaceWindowCache.StatsRecorder- Parameters:
loadTimeNanos- time to load a cache entry
-
recordLoadFailure
public void recordLoadFailure(long loadTimeNanos)
Description copied from interface:WindowCache.StatsRecorderRecord a failed load of a cache entry- Specified by:
recordLoadFailurein interfaceWindowCache.StatsRecorder- Parameters:
loadTimeNanos- time used trying to load a cache entry
-
recordEvictions
public void recordEvictions(int count)
Description copied from interface:WindowCache.StatsRecorderRecord cache evictions due to the cache evictions strategy- Specified by:
recordEvictionsin interfaceWindowCache.StatsRecorder- Parameters:
count- number of evictions to record
-
recordOpenFiles
public void recordOpenFiles(int delta)
Description copied from interface:WindowCache.StatsRecorderRecord files opened by cache- Specified by:
recordOpenFilesin interfaceWindowCache.StatsRecorder- Parameters:
delta- delta of number of files opened by cache
-
recordOpenBytes
public void recordOpenBytes(Pack pack, int delta)
Description copied from interface:WindowCache.StatsRecorderRecord cached bytes- Specified by:
recordOpenBytesin interfaceWindowCache.StatsRecorder- Parameters:
pack- pack file the bytes are read fromdelta- delta of cached bytes
-
repositoryId
private static java.lang.String repositoryId(Pack pack)
-
getStats
public WindowCacheStats getStats()
Description copied from interface:WindowCache.StatsRecorderReturns a snapshot of this recorder's stats. Note that this may be an inconsistent view, as it may be interleaved with update operations.- Specified by:
getStatsin interfaceWindowCache.StatsRecorder- Returns:
- a snapshot of this recorder's stats
-
getHitCount
public long getHitCount()
Description copied from interface:WindowCacheStatsNumber of cache hits- Specified by:
getHitCountin interfaceWindowCacheStats- Returns:
- number of cache hits
-
getMissCount
public long getMissCount()
Description copied from interface:WindowCacheStatsNumber of cache misses.- Specified by:
getMissCountin interfaceWindowCacheStats- Returns:
- number of cash misses
-
getLoadSuccessCount
public long getLoadSuccessCount()
Description copied from interface:WindowCacheStatsNumber of successful loads- Specified by:
getLoadSuccessCountin interfaceWindowCacheStats- Returns:
- number of successful loads
-
getLoadFailureCount
public long getLoadFailureCount()
Description copied from interface:WindowCacheStatsNumber of failed loads- Specified by:
getLoadFailureCountin interfaceWindowCacheStats- Returns:
- number of failed loads
-
getEvictionCount
public long getEvictionCount()
Description copied from interface:WindowCacheStatsNumber of cache evictions- Specified by:
getEvictionCountin interfaceWindowCacheStats- Returns:
- number of evictions
-
getTotalLoadTime
public long getTotalLoadTime()
Description copied from interface:WindowCacheStatsTotal time in nanoseconds the cache spent loading new values.- Specified by:
getTotalLoadTimein interfaceWindowCacheStats- Returns:
- the total number of nanoseconds the cache has spent loading new values
-
getOpenFileCount
public long getOpenFileCount()
Description copied from interface:WindowCacheStatsNumber of pack files kept open by the cache- Specified by:
getOpenFileCountin interfaceWindowCacheStats- Returns:
- number of files kept open by cache
-
getOpenByteCount
public long getOpenByteCount()
Description copied from interface:WindowCacheStatsNumber of bytes cached- Specified by:
getOpenByteCountin interfaceWindowCacheStats- Returns:
- number of bytes cached
-
resetCounters
public void resetCounters()
Description copied from interface:WindowCacheStatsReset counters. Does not reset open bytes and open files counters.- Specified by:
resetCountersin interfaceWindowCacheStats
-
getOpenByteCountPerRepository
public java.util.Map<java.lang.String,java.lang.Long> getOpenByteCountPerRepository()
Description copied from interface:WindowCacheStatsNumber of bytes cached per repository- Specified by:
getOpenByteCountPerRepositoryin interfaceWindowCacheStats- Returns:
- number of bytes cached per repository
-
-