Fix percentage calculation - dedup - deduplicating backup program HTML git clone git://bitreich.org/dedup/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/dedup/ DIR Log DIR Files DIR Refs DIR Tags DIR README DIR LICENSE --- DIR commit 71a2045de89e6fbe69797470ee4f0110608b0765 DIR parent b8b0b8ba4b138cb9bbf631e21435ee7c9034e25b HTML Author: sin <sin@2f30.org> Date: Mon, 1 Apr 2019 15:45:13 +0100 Fix percentage calculation Diffstat: M dedup.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- DIR diff --git a/dedup.c b/dedup.c @@ -50,6 +50,7 @@ static void print_stats(struct stats *st) { unsigned long long hits, misses; + double hitratio; if (st->nr_blks == 0) return; @@ -69,8 +70,9 @@ print_stats(struct stats *st) fprintf(stderr, "Number of unique blocks: %llu\n", (unsigned long long)st->nr_blks); icache_stats(icache, &hits, &misses); + hitratio = (double)hits / (hits + misses); fprintf(stderr, "Index cache hit percentage: %.2f%%\n", - (double)100 * (hits / (hits + misses))); + 100 * hitratio); } static struct snap *