dedup

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

commit b32c5c5b3c6b92b0a10ddc694e7df2d233c43c52
parent 0b721adea7ed4e7d16054d439bb092a2905bade8
Author: sin <sin@2f30.org>
Date:   Sun, 17 Feb 2019 09:54:19 +0000

Print some stats about blk size in verbose output

Tweak sizes again.

Diffstat:
Mdedup.c | 27++++++++++++++++++++-------
1 file changed, 20 insertions(+), 7 deletions(-)

diff --git a/dedup.c b/dedup.c @@ -16,8 +16,8 @@ #define STOREF ".store" #define CACHEF ".cache" -#define BLKSIZ (8*1024*1024) -#define WINSIZ 4096 +#define BLKSIZ (1024 * 512) +#define WINSIZ 1024 #define HASHMSK ((1ul << 21) - 1) #define MDSIZ SHA256_DIGEST_LENGTH @@ -556,6 +556,11 @@ void init_cache(void) { uint64_t nents, i; + uint64_t min, max, avg; + + min = BLKSIZ; + max = 0; + avg = 0; nents = cache_nents(); lseek(cfd, 0, SEEK_SET); @@ -567,11 +572,19 @@ init_cache(void) errx(1, "read: unexpected EOF"); add_cent(cent); - if (verbose) { - fprintf(stderr, "bdescr.offset: %llu bdescr.size: %llu\n", - (unsigned long long)cent->bdescr.offset, - (unsigned long long)cent->bdescr.size); - } + if (cent->bdescr.size > max) + max = cent->bdescr.size; + if (cent->bdescr.size < min) + min = cent->bdescr.size; + avg += cent->bdescr.size; + } + avg /= nents; + + if (verbose) { + fprintf(stderr, "min/avg/max blksize: %llu/%llu/%llu\n", + (unsigned long long)min, + (unsigned long long)avg, + (unsigned long long)max); } }