From 1382e566c5ce36cd915afbe9177315f5f9961e47 Mon Sep 17 00:00:00 2001 From: Sam Judd Date: Fri, 27 Sep 2019 06:20:50 -0700 Subject: [PATCH] Add getters to Bitmap Pool for cache statistics. PiperOrigin-RevId: 271557242 --- README.md | 8 ++++---- .../engine/bitmap_recycle/LruBitmapPool.java | 20 +++++++++++++++++++ 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 033f714695..f4bb5ed31b 100644 --- a/README.md +++ b/README.md @@ -31,8 +31,8 @@ repositories { } dependencies { -  implementation 'com.github.bumptech.glide:glide:4.10.0' - annotationProcessor 'com.github.bumptech.glide:compiler:4.10.0' +  implementation 'com.github.bumptech.glide:glide:4.9.0' + annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0' } ``` @@ -42,12 +42,12 @@ Or Maven: com.github.bumptech.glide glide - 4.10.0 + 4.9.0 com.github.bumptech.glide compiler - 4.10.0 + 4.9.0 true ``` diff --git a/library/src/main/java/com/bumptech/glide/load/engine/bitmap_recycle/LruBitmapPool.java b/library/src/main/java/com/bumptech/glide/load/engine/bitmap_recycle/LruBitmapPool.java index e55ca1a914..8ebf35628d 100644 --- a/library/src/main/java/com/bumptech/glide/load/engine/bitmap_recycle/LruBitmapPool.java +++ b/library/src/main/java/com/bumptech/glide/load/engine/bitmap_recycle/LruBitmapPool.java @@ -68,6 +68,26 @@ public LruBitmapPool(long maxSize, Set allowedConfigs) { this(maxSize, getDefaultStrategy(), allowedConfigs); } + /** Returns the number of cache hits for bitmaps in the pool. */ + public long hitCount() { + return hits; + } + + /** Returns the number of cache misses for bitmaps in the pool. */ + public long missCount() { + return misses; + } + + /** Returns the number of bitmaps that have been evicted from the pool. */ + public long evictionCount() { + return evictions; + } + + /** Returns the current size of the pool in bytes. */ + public long getCurrentSize() { + return currentSize; + } + @Override public long getMaxSize() { return maxSize;