dedup

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

commit 8a5d9a252075a8eeec32c53f362746e91386ef2b
parent 71a2045de89e6fbe69797470ee4f0110608b0765
Author: sin <sin@2f30.org>
Date:   Fri,  5 Apr 2019 08:26:55 +0100

Check for divzero

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

diff --git a/dedup.c b/dedup.c @@ -69,8 +69,13 @@ print_stats(struct stats *st) (unsigned long long)st->max_blk_size); fprintf(stderr, "Number of unique blocks: %llu\n", (unsigned long long)st->nr_blks); + icache_stats(icache, &hits, &misses); - hitratio = (double)hits / (hits + misses); + if (hits == 0 && misses == 0) + hitratio = 0; + else + hitratio = (double)hits / (hits + misses); + fprintf(stderr, "Index cache hit percentage: %.2f%%\n", 100 * hitratio); }