commit 315fa2b2ac76949450623ae5afdd37942ae689ee from: Stefan Sperling date: Sat Sep 15 18:19:18 2018 UTC count cache eviction events in cache debug stats commit - cec9c8a2c9c3bf370bde0d5a9e8d731ed324df5b commit + 315fa2b2ac76949450623ae5afdd37942ae689ee blob - 871bc3ca8a4a7207189fb3c8f90b89a094fc37ce blob + 7c8c41b8eb8e5a978eb79f0ba8aa060b51598707 --- lib/got_lib_object_cache.h +++ lib/got_lib_object_cache.h @@ -35,6 +35,7 @@ struct got_object_cache { size_t size; int cache_hit; int cache_miss; + int cache_evict; }; const struct got_error *got_object_cache_init(struct got_object_cache *, blob - 1e3d2dc1c907a3536d0be9daae3aca864f138625 blob + ed74d0d907f7e57b7ef46e3132bb336eb7b93051 --- lib/object_cache.c +++ lib/object_cache.c @@ -87,6 +87,7 @@ got_object_cache_add(struct got_object_cache *cache, s break; } free(ce); + cache->cache_evict++; } ce = calloc(1, sizeof(*ce)); @@ -141,9 +142,10 @@ got_object_cache_get(struct got_object_cache *cache, s static void print_cache_stats(struct got_object_cache *cache, const char *name) { - fprintf(stderr, "%s cache: %d elements, %d hits, %d missed\n", + fprintf(stderr, "%s cache: %d elements, %d hits, %d missed, " + "%d evicted\n", name, got_object_idcache_num_elements(cache->idcache), - cache->cache_hit, cache->cache_miss); + cache->cache_hit, cache->cache_miss, cache->cache_evict); } void check_refcount(struct got_object_id *id, void *data, void *arg)