Commit f4081577c6c649149ef61572d31b82167e5ad33b

Stefan Sperling 2018-09-15T20:45:42

add a Makefile.inc knob which enables cache debug output

diff --git a/Makefile.inc b/Makefile.inc
index 894e86c..d8a7f34 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -3,6 +3,7 @@ GOT_LIBEXECDIR = ${HOME}/bin
 CFLAGS += -Werror -Wall -Wstrict-prototypes -Wunused-variable
 #CFLAGS += -DGOT_PACK_NO_MMAP
 #CFLAGS += -DGOT_NO_OBJ_CACHE
+#CFLAGS += -DGOT_OBJ_CACHE_DEBUG
 
 .if defined(PROFILE)
 CC = gcc
diff --git a/lib/object_cache.c b/lib/object_cache.c
index 3de45cd..37d339c 100644
--- a/lib/object_cache.c
+++ b/lib/object_cache.c
@@ -138,7 +138,7 @@ got_object_cache_get(struct got_object_cache *cache, struct got_object_id *id)
 	return NULL;
 }
 
-#if 0
+#ifdef GOT_OBJ_CACHE_DEBUG
 static void
 print_cache_stats(struct got_object_cache *cache, const char *name)
 {
@@ -190,7 +190,7 @@ void check_refcount(struct got_object_id *id, void *data, void *arg)
 void
 got_object_cache_close(struct got_object_cache *cache)
 {
-#if 0
+#ifdef GOT_OBJ_CACHE_DEBUG
 	switch (cache->type) {
 	case GOT_OBJECT_CACHE_TYPE_OBJ:
 		print_cache_stats(cache, "object");