Commit Diff


commit - 0ffe39b0c5a0f782cded7ffb2154b89a1c3c2086
commit + b77715b73bccc5e7b56252864e0b7902a3a17626
blob - 652315fc34dc51cb0f159461f65511dfbada7f1b
blob + a88ea5659f6ff7be69d846ef2825a6e32b5963a7
--- lib/delta_cache.c
+++ lib/delta_cache.c
@@ -65,6 +65,7 @@ struct got_delta_cache {
 	int cache_miss;
 	int cache_evict;
 	int cache_toolarge;
+	int cache_maxtoolarge;
 	unsigned int flags;
 #define GOT_DELTA_CACHE_F_NOMEM	0x01
 	SIPHASH_KEY key;
@@ -104,9 +105,10 @@ got_delta_cache_free(struct got_delta_cache *cache)
 
 #ifdef GOT_DELTA_CACHE_DEBUG
 	fprintf(stderr, "%s: delta cache: %u elements, %d searches, %d hits, "
-	    "%d missed, %d evicted, %d too large\n", getprogname(),
+	    "%d missed, %d evicted, %d too large (max %d)\n", getprogname(),
 	    cache->totelem, cache->cache_search, cache->cache_hit,
-	    cache->cache_miss, cache->cache_evict, cache->cache_toolarge);
+	    cache->cache_miss, cache->cache_evict, cache->cache_toolarge,
+	    cache->cache_maxtoolarge);
 #endif
 	for (i = 0; i < cache->nbuckets; i++) {
 		struct got_delta_cache_head *head;
@@ -204,6 +206,8 @@ got_delta_cache_add(struct got_delta_cache *cache,
 
 	if (delta_len > GOT_DELTA_CACHE_MAX_DELTA_SIZE) {
 		cache->cache_toolarge++;
+		if (delta_len > cache->cache_maxtoolarge)
+			cache->cache_maxtoolarge = delta_len;
 		return got_error(GOT_ERR_NO_SPACE);
 	}