dedup

data deduplication program
git clone git://git.2f30.org/dedup.git
Log | Files | Refs | README | LICENSE

commit 71a2045de89e6fbe69797470ee4f0110608b0765
parent b8b0b8ba4b138cb9bbf631e21435ee7c9034e25b
Author: sin <sin@2f30.org>
Date:   Mon,  1 Apr 2019 15:45:13 +0100

Fix percentage calculation

Diffstat:
Mdedup.c | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

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 *