commit bc7c1b2b360b2ca63845092283b61edc2b247231
parent 75462091afc92997fb825e90d160bf5084b1242e
Author: sin <sin@2f30.org>
Date: Thu, 18 Apr 2019 13:05:32 +0100
dup-pack: Print index cache hit percentage in verbose mode
Diffstat:
1 file changed, 10 insertions(+), 0 deletions(-)
diff --git a/dup-pack.c b/dup-pack.c
@@ -102,6 +102,16 @@ dedup(int fd, char *msg)
}
hash_snap(snap, snap->md, hash_algo);
append_snap(ifd, &snap_hdr, snap);
+
+ if (verbose > 0) {
+ unsigned long long hits, misses;
+ double hitratio;
+
+ icache_stats(icache, &hits, &misses);
+ hitratio = (double)hits / (hits + misses);
+ fprintf(stderr, "Index cache hit percentage: %.2f%%\n",
+ 100 * hitratio);
+ }
}
free_chunker(chunker);