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.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 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 long
getEvictionCount()
Number of cache evictionslong
getHitCount()
Number of cache hitslong
getLoadFailureCount()
Number of failed loadslong
getLoadSuccessCount()
Number of successful loadslong
getMissCount()
Number of cache misses.long
getOpenByteCount()
Number of bytes cachedjava.util.Map<java.lang.String,java.lang.Long>
getOpenByteCountPerRepository()
Number of bytes cached per repositorylong
getOpenFileCount()
Number of pack files kept open by the cacheWindowCacheStats
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 strategyvoid
recordHits(int count)
Record cache hits.void
recordLoadFailure(long loadTimeNanos)
Record a failed load of a cache entryvoid
recordLoadSuccess(long loadTimeNanos)
Record a successful load of a cache entryvoid
recordMisses(int count)
Record cache misses.void
recordOpenBytes(PackFile pack, int delta)
Record cached bytesvoid
recordOpenFiles(int delta)
Record files opened by cacheprivate static java.lang.String
repositoryId(PackFile pack)
void
resetCounters()
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.StatsRecorder
Record cache hits. Called when cache returns a cached entry.- Specified by:
recordHits
in interfaceWindowCache.StatsRecorder
- Parameters:
count
- number of cache hits to record
-
recordMisses
public void recordMisses(int count)
Description copied from interface:WindowCache.StatsRecorder
Record cache misses. Called when the cache returns an entry which had to be loaded.- Specified by:
recordMisses
in interfaceWindowCache.StatsRecorder
- Parameters:
count
- number of cache misses to record
-
recordLoadSuccess
public void recordLoadSuccess(long loadTimeNanos)
Description copied from interface:WindowCache.StatsRecorder
Record a successful load of a cache entry- Specified by:
recordLoadSuccess
in interfaceWindowCache.StatsRecorder
- Parameters:
loadTimeNanos
- time to load a cache entry
-
recordLoadFailure
public void recordLoadFailure(long loadTimeNanos)
Description copied from interface:WindowCache.StatsRecorder
Record a failed load of a cache entry- Specified by:
recordLoadFailure
in interfaceWindowCache.StatsRecorder
- Parameters:
loadTimeNanos
- time used trying to load a cache entry
-
recordEvictions
public void recordEvictions(int count)
Description copied from interface:WindowCache.StatsRecorder
Record cache evictions due to the cache evictions strategy- Specified by:
recordEvictions
in interfaceWindowCache.StatsRecorder
- Parameters:
count
- number of evictions to record
-
recordOpenFiles
public void recordOpenFiles(int delta)
Description copied from interface:WindowCache.StatsRecorder
Record files opened by cache- Specified by:
recordOpenFiles
in interfaceWindowCache.StatsRecorder
- Parameters:
delta
- delta of number of files opened by cache
-
recordOpenBytes
public void recordOpenBytes(PackFile pack, int delta)
Description copied from interface:WindowCache.StatsRecorder
Record cached bytes- Specified by:
recordOpenBytes
in interfaceWindowCache.StatsRecorder
- Parameters:
pack
- pack file the bytes are read fromdelta
- delta of cached bytes
-
repositoryId
private static java.lang.String repositoryId(PackFile pack)
-
getStats
public WindowCacheStats getStats()
Description copied from interface:WindowCache.StatsRecorder
Returns 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:
getStats
in interfaceWindowCache.StatsRecorder
- Returns:
- a snapshot of this recorder's stats
-
getHitCount
public long getHitCount()
Description copied from interface:WindowCacheStats
Number of cache hits- Specified by:
getHitCount
in interfaceWindowCacheStats
- Returns:
- number of cache hits
-
getMissCount
public long getMissCount()
Description copied from interface:WindowCacheStats
Number of cache misses.- Specified by:
getMissCount
in interfaceWindowCacheStats
- Returns:
- number of cash misses
-
getLoadSuccessCount
public long getLoadSuccessCount()
Description copied from interface:WindowCacheStats
Number of successful loads- Specified by:
getLoadSuccessCount
in interfaceWindowCacheStats
- Returns:
- number of successful loads
-
getLoadFailureCount
public long getLoadFailureCount()
Description copied from interface:WindowCacheStats
Number of failed loads- Specified by:
getLoadFailureCount
in interfaceWindowCacheStats
- Returns:
- number of failed loads
-
getEvictionCount
public long getEvictionCount()
Description copied from interface:WindowCacheStats
Number of cache evictions- Specified by:
getEvictionCount
in interfaceWindowCacheStats
- Returns:
- number of evictions
-
getTotalLoadTime
public long getTotalLoadTime()
Description copied from interface:WindowCacheStats
Total time in nanoseconds the cache spent loading new values.- Specified by:
getTotalLoadTime
in interfaceWindowCacheStats
- Returns:
- the total number of nanoseconds the cache has spent loading new values
-
getOpenFileCount
public long getOpenFileCount()
Description copied from interface:WindowCacheStats
Number of pack files kept open by the cache- Specified by:
getOpenFileCount
in interfaceWindowCacheStats
- Returns:
- number of files kept open by cache
-
getOpenByteCount
public long getOpenByteCount()
Description copied from interface:WindowCacheStats
Number of bytes cached- Specified by:
getOpenByteCount
in interfaceWindowCacheStats
- Returns:
- number of bytes cached
-
resetCounters
public void resetCounters()
Description copied from interface:WindowCacheStats
Reset counters. Does not reset open bytes and open files counters.- Specified by:
resetCounters
in interfaceWindowCacheStats
-
getOpenByteCountPerRepository
public java.util.Map<java.lang.String,java.lang.Long> getOpenByteCountPerRepository()
Description copied from interface:WindowCacheStats
Number of bytes cached per repository- Specified by:
getOpenByteCountPerRepository
in interfaceWindowCacheStats
- Returns:
- number of bytes cached per repository
-
-