diff options
author | Bill Wendling <wendling@ncsa.uiuc.edu> | 2002-06-07 22:06:27 (GMT) |
---|---|---|
committer | Bill Wendling <wendling@ncsa.uiuc.edu> | 2002-06-07 22:06:27 (GMT) |
commit | b77825d9a72db083a5b8bd03801848d87d02a942 (patch) | |
tree | 7ed0cd2a219b0da2260c7e62e6b4abf6aa45e9b6 /perform | |
parent | c8721abdbc0b92277611bc97f9ed4d843d93d4f9 (diff) | |
download | hdf5-b77825d9a72db083a5b8bd03801848d87d02a942.zip hdf5-b77825d9a72db083a5b8bd03801848d87d02a942.tar.gz hdf5-b77825d9a72db083a5b8bd03801848d87d02a942.tar.bz2 |
[svn-r5555] Purpose:
Feature Update
Description:
It now writes an uncompressed version of the file out. The first
tests didn't look all that wonderful. Here is a typical output:
Buffer size == 1MB
Uncompressed Write Time: 0.55s
Uncompressed Write Throughput: 116.00MB/s
Compressed Write Time: 8.76s
Compressed Write Throughput: 7.31MB/s
Platforms tested:
Linux
Diffstat (limited to 'perform')
-rw-r--r-- | perform/zip_perf.c | 48 |
1 files changed, 46 insertions, 2 deletions
diff --git a/perform/zip_perf.c b/perform/zip_perf.c index 066fce9..2d51b3b 100644 --- a/perform/zip_perf.c +++ b/perform/zip_perf.c @@ -199,6 +199,8 @@ write_file(Bytef *source, uLongf sourceLen) d_len -= rc; d_ptr += rc; } + + free(dest); } /* @@ -375,6 +377,9 @@ do_write_test(unsigned long file_size, unsigned long min_buf_size, Bytef *src; for (src_len = min_buf_size; src_len <= max_buf_size; src_len <<= 1) { + register int i, iters; + + iters = file_size / src_len; src = (Bytef *)calloc(1, sizeof(Bytef) * src_len); if (!src) { @@ -395,14 +400,31 @@ do_write_test(unsigned long file_size, unsigned long min_buf_size, } printf("\n"); + + /* do uncompressed data write */ gettimeofday(&timer_start, NULL); output = open(filename, O_RDWR | O_TRUNC); if (output == -1) error(strerror(errno)); - for (total_len = 0; total_len < file_size; total_len += src_len) { - write_file(src, src_len); + for (i = 0; i <= iters; ++i) { + Bytef *s_ptr = src; + uLong s_len = src_len; + + /* loop to make sure we write everything out that we want to write */ + for (;;) { + int rc = write(output, s_ptr, s_len); + + if (rc == -1) + error(strerror(errno)); + + if (rc == s_len) + break; + + s_len -= rc; + s_ptr += rc; + } } close(output); @@ -413,6 +435,28 @@ do_write_test(unsigned long file_size, unsigned long min_buf_size, ((double)timer_start.tv_sec + ((double)timer_start.tv_usec) / MICROSECOND); + printf("\tUncompressed Write Time: %.2fs\n", total_time); + printf("\tUncompressed Write Throughput: %.2fMB/s\n", + MB_PER_SEC(file_size, total_time)); + + /* do compressed data write */ + output = open(filename, O_RDWR | O_TRUNC); + + if (output == -1) + error(strerror(errno)); + + + for (total_len = 0; total_len < file_size; total_len += src_len) + write_file(src, src_len); + + close(output); + gettimeofday(&timer_stop, NULL); + + total_time = ((double)timer_stop.tv_sec + + ((double)timer_stop.tv_usec) / MICROSECOND) - + ((double)timer_start.tv_sec + + ((double)timer_start.tv_usec) / MICROSECOND); + printf("\tCompressed Write Time: %.2fs\n", total_time); printf("\tCompressed Write Throughput: %.2fMB/s\n", MB_PER_SEC(file_size, total_time)); |