mirror of
https://github.com/HDFGroup/hdf5.git
synced 2024-11-27 02:10:55 +08:00
[svn-r5601] Purpose:
More Output Description: Added some more output, including the compression ratio. Platforms tested: Linux, FreeBSD
This commit is contained in:
parent
1b082cf2c2
commit
3bbc9285cf
@ -89,6 +89,7 @@ static const char *option_prefix;
|
|||||||
static char *filename;
|
static char *filename;
|
||||||
static int compress_level = Z_DEFAULT_COMPRESSION;
|
static int compress_level = Z_DEFAULT_COMPRESSION;
|
||||||
static int output, random_test = FALSE;
|
static int output, random_test = FALSE;
|
||||||
|
static int report_once_flag;
|
||||||
|
|
||||||
/* internal functions */
|
/* internal functions */
|
||||||
static void error(const char *fmt, ...);
|
static void error(const char *fmt, ...);
|
||||||
@ -194,6 +195,11 @@ write_file(Bytef *source, uLongf sourceLen)
|
|||||||
|
|
||||||
compress_buffer(dest, &destLen, source, 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_ptr = dest;
|
||||||
d_len = destLen;
|
d_len = destLen;
|
||||||
|
|
||||||
@ -462,6 +468,7 @@ do_write_test(unsigned long file_size, unsigned long min_buf_size,
|
|||||||
if (output == -1)
|
if (output == -1)
|
||||||
error(strerror(errno));
|
error(strerror(errno));
|
||||||
|
|
||||||
|
report_once_flag = 1;
|
||||||
|
|
||||||
for (total_len = 0; total_len < file_size; total_len += src_len)
|
for (total_len = 0; total_len < file_size; total_len += src_len)
|
||||||
write_file(src, 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)",
|
error("minmum buffer size (%d) exceeds maximum buffer size (%d)",
|
||||||
min_buf_size, max_buf_size);
|
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();
|
get_unique_name();
|
||||||
do_write_test(file_size, min_buf_size, max_buf_size);
|
do_write_test(file_size, min_buf_size, max_buf_size);
|
||||||
cleanup();
|
cleanup();
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else /* H5_HAVE_ZLIB_H */
|
#else
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Function: main
|
* Function: main
|
||||||
|
Loading…
Reference in New Issue
Block a user