Commit 1722f06e authored by Mike Hibler's avatar Mike Hibler

Add -q (quiet) option so it doesn't spit out hash stats.

parent af9b08f3
......@@ -88,6 +88,7 @@ static int sanity = 0;
#ifdef HANDLE_SPLIT_HASH
static int splithash = 0;
#endif
static int quiet = 0;
static char chunkbuf[CHUNKSIZE];
......@@ -130,7 +131,7 @@ main(int argc, char **argv)
extern char build_info[];
struct hashinfo *hashinfo = 0;
while ((ch = getopt(argc, argv, "cCb:dvhno:rD:NVRF:SX")) != -1)
while ((ch = getopt(argc, argv, "cCb:dvhno:rD:NVRF:SXq")) != -1)
switch(ch) {
case 'b':
hashblksize = atol(optarg);
......@@ -199,6 +200,9 @@ main(int argc, char **argv)
fprintf(stderr, "-X not supported, ignored\n");
#endif
break;
case 'q':
quiet = 1;
break;
case 'h':
case '?':
default:
......@@ -649,10 +653,12 @@ createhash(char *name, struct hashinfo **hinfop)
fprintf(stderr, "%s: WARNING: could not set mtime (%s)\n",
hfile, strerror(errno));
dump_stats(0);
if (!quiet) {
dump_stats(0);
#ifdef TIMEIT
printf("%qu bytes: inflate cycles: %llu\n",
ndatabytes, (unsigned long long)dcycles);
printf("%qu bytes: inflate cycles: %llu\n",
ndatabytes, (unsigned long long)dcycles);
}
#endif
free(hfile);
return 0;
......@@ -846,18 +852,22 @@ checkhash(char *name, struct hashinfo *hinfo)
stopreader();
dump_stats(0);
if (badhashes)
printf("%s: %u regions (%d chunks) had bad hashes, "
"%llu bytes affected\n",
name, badhashes, badchunks,
(unsigned long long)badhashdata);
dump_readbufs();
if (!quiet) {
dump_stats(0);
if (badhashes)
printf("%s: %u regions (%d chunks) had bad hashes, "
"%llu bytes affected\n",
name, badhashes, badchunks,
(unsigned long long)badhashdata);
dump_readbufs();
#ifdef TIMEIT
printf("%llu bytes: read cycles: %llu, hash cycles: %llu, cmp cycles: %llu\n",
ndatabytes, (unsigned long long)rcycles,
(unsigned long long)hcycles, (unsigned long long)ccycles);
printf("%llu bytes: read cycles: "
"%llu, hash cycles: %llu, cmp cycles: %llu\n",
ndatabytes, (unsigned long long)rcycles,
(unsigned long long)hcycles,
(unsigned long long)ccycles);
#endif
}
return badhashes;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment