From 3bbc9285cf7bda368f18cc724f14edcf2828a0ea Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Wed, 12 Jun 2002 10:56:10 -0500 Subject: [PATCH] [svn-r5601] Purpose: More Output Description: Added some more output, including the compression ratio. Platforms tested: Linux, FreeBSD --- perform/zip_perf.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/perform/zip_perf.c b/perform/zip_perf.c index 614f5a1562..26b0ea4094 100644 --- a/perform/zip_perf.c +++ b/perform/zip_perf.c @@ -89,6 +89,7 @@ static const char *option_prefix; static char *filename; static int compress_level = Z_DEFAULT_COMPRESSION; static int output, random_test = FALSE; +static int report_once_flag; /* internal functions */ static void error(const char *fmt, ...); @@ -194,6 +195,11 @@ write_file(Bytef *source, uLongf sourceLen) compress_buffer(dest, &destLen, source, sourceLen); + if (report_once_flag) { + printf("\tCompression Ratio: %g\n", ((double)destLen) / sourceLen); + report_once_flag = 0; + } + d_ptr = dest; d_len = destLen; @@ -462,6 +468,7 @@ do_write_test(unsigned long file_size, unsigned long min_buf_size, if (output == -1) error(strerror(errno)); + report_once_flag = 1; for (total_len = 0; total_len < file_size; total_len += src_len) write_file(src, src_len); @@ -537,13 +544,20 @@ main(int argc, char **argv) error("minmum buffer size (%d) exceeds maximum buffer size (%d)", min_buf_size, max_buf_size); + printf("Filesize: %ld\n", file_size); + + if (compress_level == Z_DEFAULT_COMPRESSION) + printf("Compression Level: 6\n"); + else + printf("Compression Level: %d\n", compress_level); + get_unique_name(); do_write_test(file_size, min_buf_size, max_buf_size); cleanup(); return EXIT_SUCCESS; } -#else /* H5_HAVE_ZLIB_H */ +#else /* * Function: main