summaryrefslogtreecommitdiffstats
path: root/tools/test/perform
diff options
context:
space:
mode:
authorDana Robinson <43805+derobins@users.noreply.github.com>2023-07-27 20:43:30 (GMT)
committerGitHub <noreply@github.com>2023-07-27 20:43:30 (GMT)
commit1e91d96fa02466ffe451319bdac1005f84dc7993 (patch)
tree4de04ef502c313dfd766497b20235188761146c0 /tools/test/perform
parent95e5349089b95dfb95f0f8ce2d6db1bc04ba6c82 (diff)
downloadhdf5-1e91d96fa02466ffe451319bdac1005f84dc7993.zip
hdf5-1e91d96fa02466ffe451319bdac1005f84dc7993.tar.gz
hdf5-1e91d96fa02466ffe451319bdac1005f84dc7993.tar.bz2
Brings over most of the HD prefix removal (#3293)
Diffstat (limited to 'tools/test/perform')
-rw-r--r--tools/test/perform/chunk_cache.c32
-rw-r--r--tools/test/perform/direct_write_perf.c2
-rw-r--r--tools/test/perform/iopipe.c74
-rw-r--r--tools/test/perform/overhead.c10
-rw-r--r--tools/test/perform/perf_meta.c23
-rw-r--r--tools/test/perform/zip_perf.c104
6 files changed, 121 insertions, 124 deletions
diff --git a/tools/test/perform/chunk_cache.c b/tools/test/perform/chunk_cache.c
index 9f6554d..289d7c0 100644
--- a/tools/test/perform/chunk_cache.c
+++ b/tools/test/perform/chunk_cache.c
@@ -134,7 +134,7 @@ create_dset1(hid_t file)
H5Dclose(dataset);
H5Pclose(dcpl);
H5Sclose(dataspace);
- HDfree(data);
+ free(data);
return 0;
error:
@@ -145,7 +145,7 @@ error:
H5Sclose(dataspace);
}
H5E_END_TRY;
- HDfree(data);
+ free(data);
return 1;
}
@@ -198,7 +198,7 @@ create_dset2(hid_t file)
H5Dclose(dataset);
H5Pclose(dcpl);
H5Sclose(dataspace);
- HDfree(data);
+ free(data);
return 0;
@@ -210,7 +210,7 @@ error:
H5Sclose(dataspace);
}
H5E_END_TRY;
- HDfree(data);
+ free(data);
return 1;
}
@@ -264,13 +264,12 @@ check_partial_chunks_perf(hid_t file)
end_t = H5_get_time();
if ((end_t - start_t) > 0.0)
- HDprintf("1. Partial chunks: total read time is %lf; number of bytes being read from file is %zu\n",
- (end_t - start_t), nbytes_global);
+ printf("1. Partial chunks: total read time is %lf; number of bytes being read from file is %zu\n",
+ (end_t - start_t), nbytes_global);
else
- HDprintf(
- "1. Partial chunks: no total read time because timer is not available; number of bytes being "
- "read from file is %zu\n",
- nbytes_global);
+ printf("1. Partial chunks: no total read time because timer is not available; number of bytes being "
+ "read from file is %zu\n",
+ nbytes_global);
H5Dclose(dataset);
H5Sclose(filespace);
@@ -343,13 +342,12 @@ check_hash_value_perf(hid_t file)
end_t = H5_get_time();
if ((end_t - start_t) > 0.0)
- HDprintf("2. Hash value: total read time is %lf; number of bytes being read from file is %zu\n",
- (end_t - start_t), nbytes_global);
+ printf("2. Hash value: total read time is %lf; number of bytes being read from file is %zu\n",
+ (end_t - start_t), nbytes_global);
else
- HDprintf(
- "2. Hash value: no total read time because timer is not available; number of bytes being read "
- "from file is %zu\n",
- nbytes_global);
+ printf("2. Hash value: no total read time because timer is not available; number of bytes being read "
+ "from file is %zu\n",
+ nbytes_global);
H5Dclose(dataset);
H5Sclose(filespace);
@@ -407,6 +405,6 @@ main(void)
return 0;
error:
- HDfprintf(stderr, "*** ERRORS DETECTED ***\n");
+ fprintf(stderr, "*** ERRORS DETECTED ***\n");
return 1;
}
diff --git a/tools/test/perform/direct_write_perf.c b/tools/test/perform/direct_write_perf.c
index 0d94cf5..7772324 100644
--- a/tools/test/perform/direct_write_perf.c
+++ b/tools/test/perform/direct_write_perf.c
@@ -693,7 +693,7 @@ main(void)
int
main(void)
{
- HDfprintf(stdout, "No compression IO performance because zlib was not configured\n");
+ fprintf(stdout, "No compression IO performance because zlib was not configured\n");
return EXIT_SUCCESS;
}
diff --git a/tools/test/perform/iopipe.c b/tools/test/perform/iopipe.c
index c61e6a9..c184917 100644
--- a/tools/test/perform/iopipe.c
+++ b/tools/test/perform/iopipe.c
@@ -73,9 +73,9 @@ print_stats(const char *prefix,
H5_bandwidth(bw, sizeof(bw), (double)nbytes, e_time);
#ifdef H5_HAVE_GETRUSAGE
- HDprintf(HEADING "%1.2fuser %1.2fsystem %1.2felapsed %s\n", prefix, u_time, s_time, e_time, bw);
+ printf(HEADING "%1.2fuser %1.2fsystem %1.2felapsed %s\n", prefix, u_time, s_time, e_time, bw);
#else
- HDprintf(HEADING "%1.2felapsed %s\n", prefix, e_time, bw);
+ printf(HEADING "%1.2felapsed %s\n", prefix, e_time, bw);
#endif
}
@@ -100,10 +100,10 @@ synchronize(void)
int H5_ATTR_NDEBUG_UNUSED status;
status = HDsystem("sync");
- HDassert(status >= 0);
+ assert(status >= 0);
status = HDsystem("df >/dev/null");
- HDassert(status >= 0);
+ assert(status >= 0);
#endif
}
@@ -146,23 +146,23 @@ main(void)
* Win32 version 5.0 compiler.
* 1998-11-06 ptl
*/
- HDprintf("I/O request size is %1.1fMB\n", (double)(hssize_t)(size[0] * size[1]) / 1024.0 * 1024.0);
+ printf("I/O request size is %1.1fMB\n", (double)(hssize_t)(size[0] * size[1]) / 1024.0 * 1024.0);
/* Open the files */
file = H5Fcreate(HDF5_FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- HDassert(file >= 0);
+ assert(file >= 0);
fd = HDopen(RAW_FILE_NAME, O_RDWR | O_CREAT | O_TRUNC, 0666);
- HDassert(fd >= 0);
+ assert(fd >= 0);
/* Create the dataset */
file_space = H5Screate_simple(2, size, size);
- HDassert(file_space >= 0);
+ assert(file_space >= 0);
dset = H5Dcreate2(file, "dset", H5T_NATIVE_UCHAR, file_space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- HDassert(dset >= 0);
- the_data = (unsigned char *)HDmalloc((size_t)(size[0] * size[1]));
+ assert(dset >= 0);
+ the_data = (unsigned char *)malloc((size_t)(size[0] * size[1]));
/* initial fill for lazy malloc */
- HDmemset(the_data, 0xAA, (size_t)(size[0] * size[1]));
+ memset(the_data, 0xAA, (size_t)(size[0] * size[1]));
/* Fill raw */
synchronize();
@@ -170,11 +170,11 @@ main(void)
HDgetrusage(RUSAGE_SELF, &r_start);
#endif
t_start = H5_get_time();
- HDfprintf(stderr, HEADING, "fill raw");
+ fprintf(stderr, HEADING, "fill raw");
for (u = 0; u < nwrite; u++) {
HDputc(PROGRESS, stderr);
- HDfflush(stderr);
- HDmemset(the_data, 0xAA, (size_t)(size[0] * size[1]));
+ fflush(stderr);
+ memset(the_data, 0xAA, (size_t)(size[0] * size[1]));
}
#ifdef H5_HAVE_GETRUSAGE
HDgetrusage(RUSAGE_SELF, &r_stop);
@@ -193,12 +193,12 @@ main(void)
HDgetrusage(RUSAGE_SELF, &r_start);
#endif
t_start = H5_get_time();
- HDfprintf(stderr, HEADING, "fill hdf5");
+ fprintf(stderr, HEADING, "fill hdf5");
for (u = 0; u < nread; u++) {
HDputc(PROGRESS, stderr);
- HDfflush(stderr);
+ fflush(stderr);
status = H5Dread(dset, H5T_NATIVE_UCHAR, file_space, file_space, H5P_DEFAULT, the_data);
- HDassert(status >= 0);
+ assert(status >= 0);
}
#ifdef H5_HAVE_GETRUSAGE
HDgetrusage(RUSAGE_SELF, &r_stop);
@@ -217,14 +217,14 @@ main(void)
HDgetrusage(RUSAGE_SELF, &r_start);
#endif
t_start = H5_get_time();
- HDfprintf(stderr, HEADING, "out raw");
+ fprintf(stderr, HEADING, "out raw");
for (u = 0; u < nwrite; u++) {
HDputc(PROGRESS, stderr);
- HDfflush(stderr);
+ fflush(stderr);
offset = HDlseek(fd, (off_t)0, SEEK_SET);
- HDassert(0 == offset);
+ assert(0 == offset);
n = HDwrite(fd, the_data, (size_t)(size[0] * size[1]));
- HDassert(n >= 0 && (size_t)n == (size[0] * size[1]));
+ assert(n >= 0 && (size_t)n == (size[0] * size[1]));
}
#ifdef H5_HAVE_GETRUSAGE
HDgetrusage(RUSAGE_SELF, &r_stop);
@@ -243,12 +243,12 @@ main(void)
HDgetrusage(RUSAGE_SELF, &r_start);
#endif
t_start = H5_get_time();
- HDfprintf(stderr, HEADING, "out hdf5");
+ fprintf(stderr, HEADING, "out hdf5");
for (u = 0; u < nwrite; u++) {
HDputc(PROGRESS, stderr);
- HDfflush(stderr);
+ fflush(stderr);
status = H5Dwrite(dset, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, the_data);
- HDassert(status >= 0);
+ assert(status >= 0);
}
#ifdef H5_HAVE_GETRUSAGE
HDgetrusage(RUSAGE_SELF, &r_stop);
@@ -267,14 +267,14 @@ main(void)
HDgetrusage(RUSAGE_SELF, &r_start);
#endif
t_start = H5_get_time();
- HDfprintf(stderr, HEADING, "in raw");
+ fprintf(stderr, HEADING, "in raw");
for (u = 0; u < nread; u++) {
HDputc(PROGRESS, stderr);
- HDfflush(stderr);
+ fflush(stderr);
offset = HDlseek(fd, (off_t)0, SEEK_SET);
- HDassert(0 == offset);
+ assert(0 == offset);
n = HDread(fd, the_data, (size_t)(size[0] * size[1]));
- HDassert(n >= 0 && (size_t)n == (size[0] * size[1]));
+ assert(n >= 0 && (size_t)n == (size[0] * size[1]));
}
#ifdef H5_HAVE_GETRUSAGE
HDgetrusage(RUSAGE_SELF, &r_stop);
@@ -293,12 +293,12 @@ main(void)
HDgetrusage(RUSAGE_SELF, &r_start);
#endif
t_start = H5_get_time();
- HDfprintf(stderr, HEADING, "in hdf5");
+ fprintf(stderr, HEADING, "in hdf5");
for (u = 0; u < nread; u++) {
HDputc(PROGRESS, stderr);
- HDfflush(stderr);
+ fflush(stderr);
status = H5Dread(dset, H5T_NATIVE_UCHAR, file_space, file_space, H5P_DEFAULT, the_data);
- HDassert(status >= 0);
+ assert(status >= 0);
}
#ifdef H5_HAVE_GETRUSAGE
HDgetrusage(RUSAGE_SELF, &r_stop);
@@ -312,22 +312,22 @@ main(void)
t_start, t_stop, (size_t)(nread * size[0] * size[1]));
/* Read hyperslab */
- HDassert(size[0] > 20 && size[1] > 20);
+ assert(size[0] > 20 && size[1] > 20);
start[0] = start[1] = 10;
count[0] = count[1] = size[0] - 20;
status = H5Sselect_hyperslab(file_space, H5S_SELECT_SET, start, NULL, count, NULL);
- HDassert(status >= 0);
+ assert(status >= 0);
synchronize();
#ifdef H5_HAVE_GETRUSAGE
HDgetrusage(RUSAGE_SELF, &r_start);
#endif
t_start = H5_get_time();
- HDfprintf(stderr, HEADING, "in hdf5 partial");
+ fprintf(stderr, HEADING, "in hdf5 partial");
for (u = 0; u < nread; u++) {
HDputc(PROGRESS, stderr);
- HDfflush(stderr);
+ fflush(stderr);
status = H5Dread(dset, H5T_NATIVE_UCHAR, file_space, file_space, H5P_DEFAULT, the_data);
- HDassert(status >= 0);
+ assert(status >= 0);
}
#ifdef H5_HAVE_GETRUSAGE
HDgetrusage(RUSAGE_SELF, &r_stop);
@@ -347,7 +347,7 @@ main(void)
H5Sclose(file_space);
H5Fclose(file);
- HDfree(the_data);
+ free(the_data);
return 0;
}
diff --git a/tools/test/perform/overhead.c b/tools/test/perform/overhead.c
index 257d3ec..82c7131 100644
--- a/tools/test/perform/overhead.c
+++ b/tools/test/perform/overhead.c
@@ -67,8 +67,8 @@ typedef enum fill_t { FILL_ALL, FILL_FORWARD, FILL_REVERSE, FILL_INWARD, FILL_OU
static void
usage(const char *prog)
{
- HDfprintf(stderr, "usage: %s [STYLE|cache] [LEFT [MIDDLE [RIGHT]]]\n", prog);
- HDfprintf(stderr, "\
+ fprintf(stderr, "usage: %s [STYLE|cache] [LEFT [MIDDLE [RIGHT]]]\n", prog);
+ fprintf(stderr, "\
STYLE is the order that the dataset is filled and should be one of:\n\
forward -- Fill the dataset from lowest address to highest\n\
address. This style tests the right split ratio.\n\
@@ -230,7 +230,7 @@ test(fill_t fill_style, const double splits[], hbool_t verbose, hbool_t use_rdcc
abort();
default:
/* unknown request */
- HDfprintf(stderr, "Unknown fill style\n");
+ fprintf(stderr, "Unknown fill style\n");
goto error;
break;
}
@@ -286,7 +286,7 @@ test(fill_t fill_style, const double splits[], hbool_t verbose, hbool_t use_rdcc
abort();
default:
/* unknown request */
- HDfprintf(stderr, "Unknown fill style\n");
+ fprintf(stderr, "Unknown fill style\n");
goto error;
break;
}
@@ -394,6 +394,6 @@ main(int argc, char *argv[])
return 0;
error:
- HDfprintf(stderr, "*** ERRORS DETECTED ***\n");
+ fprintf(stderr, "*** ERRORS DETECTED ***\n");
return 1;
}
diff --git a/tools/test/perform/perf_meta.c b/tools/test/perform/perf_meta.c
index 6e62f6a..37a1ffd 100644
--- a/tools/test/perform/perf_meta.c
+++ b/tools/test/perform/perf_meta.c
@@ -399,8 +399,7 @@ create_attrs_1(void)
attr_t.avg = attr_t.total / (NUM_ATTRS * NUM_DSETS);
/* Print out the performance result */
- HDfprintf(stderr, "1. Create %d attributes for each of %d existing datasets\n", NUM_ATTRS,
- NUM_DSETS);
+ fprintf(stderr, "1. Create %d attributes for each of %d existing datasets\n", NUM_ATTRS, NUM_DSETS);
print_perf(open_t, close_t, attr_t);
}
@@ -500,7 +499,7 @@ create_attrs_2(void)
attr_t.avg = attr_t.total / (NUM_ATTRS * NUM_DSETS);
/* Print out the performance result */
- HDfprintf(stderr, "2. Create %d attributes for each of %d new datasets\n", NUM_ATTRS, NUM_DSETS);
+ fprintf(stderr, "2. Create %d attributes for each of %d new datasets\n", NUM_ATTRS, NUM_DSETS);
print_perf(create_t, close_t, attr_t);
}
@@ -608,8 +607,8 @@ create_attrs_3(void)
attr_t.avg = attr_t.total / (NUM_ATTRS * NUM_DSETS);
/* Print out the performance result */
- HDfprintf(stderr, "3. Create %d attributes for each of %d existing datasets for %d times\n",
- BATCH_ATTRS, NUM_DSETS, loop_num);
+ fprintf(stderr, "3. Create %d attributes for each of %d existing datasets for %d times\n",
+ BATCH_ATTRS, NUM_DSETS, loop_num);
print_perf(open_t, close_t, attr_t);
}
@@ -715,13 +714,13 @@ perf(p_time *perf_t, double start_t, double end_t)
void
print_perf(p_time open_t, p_time close_t, p_time attr_t)
{
- HDfprintf(stderr, "\t%s:\t\tavg=%.6fs;\tmax=%.6fs;\tmin=%.6fs\n", open_t.func, open_t.avg, open_t.max,
- open_t.min);
- HDfprintf(stderr, "\tH5Dclose:\t\tavg=%.6fs;\tmax=%.6fs;\tmin=%.6fs\n", close_t.avg, close_t.max,
- close_t.min);
+ fprintf(stderr, "\t%s:\t\tavg=%.6fs;\tmax=%.6fs;\tmin=%.6fs\n", open_t.func, open_t.avg, open_t.max,
+ open_t.min);
+ fprintf(stderr, "\tH5Dclose:\t\tavg=%.6fs;\tmax=%.6fs;\tmin=%.6fs\n", close_t.avg, close_t.max,
+ close_t.min);
if (NUM_ATTRS)
- HDfprintf(stderr, "\tH5A(create & close):\tavg=%.6fs;\tmax=%.6fs;\tmin=%.6fs\n", attr_t.avg,
- attr_t.max, attr_t.min);
+ fprintf(stderr, "\tH5A(create & close):\tavg=%.6fs;\tmax=%.6fs;\tmin=%.6fs\n", attr_t.avg, attr_t.max,
+ attr_t.min);
}
/*-------------------------------------------------------------------------
@@ -761,7 +760,7 @@ main(int argc, char **argv)
#ifdef H5_HAVE_PARALLEL
if (facc_type == FACC_DEFAULT || (facc_type != FACC_DEFAULT && MAINPROCESS))
#endif /*H5_HAVE_PARALLEL*/
- HDfprintf(stderr, "\t\tPerformance result of metadata for datasets and attributes\n\n");
+ fprintf(stderr, "\t\tPerformance result of metadata for datasets and attributes\n\n");
fapl = H5Pcreate(H5P_FILE_ACCESS);
#ifdef H5_HAVE_PARALLEL
diff --git a/tools/test/perform/zip_perf.c b/tools/test/perform/zip_perf.c
index 256289c..00b3140 100644
--- a/tools/test/perform/zip_perf.c
+++ b/tools/test/perform/zip_perf.c
@@ -84,13 +84,13 @@ error(const char *fmt, ...)
va_list ap;
va_start(ap, fmt);
- HDfprintf(stderr, "%s: error: ", prog);
+ fprintf(stderr, "%s: error: ", prog);
H5_GCC_CLANG_DIAG_OFF("format-nonliteral")
HDvfprintf(stderr, fmt, ap);
H5_GCC_CLANG_DIAG_ON("format-nonliteral")
- HDfprintf(stderr, "\n");
+ fprintf(stderr, "\n");
va_end(ap);
- HDexit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
/*
@@ -104,7 +104,7 @@ cleanup(void)
{
if (!HDgetenv(HDF5_NOCLEANUP))
HDunlink(filename);
- HDfree(filename);
+ free(filename);
}
static void
@@ -117,7 +117,7 @@ write_file(Bytef *source, uLongf sourceLen)
/* destination buffer needs to be at least 0.1% larger than sourceLen
* plus 12 bytes */
destLen = (uLongf)((double)sourceLen + ((double)sourceLen * 0.1)) + 12;
- dest = (Bytef *)HDmalloc(destLen);
+ dest = (Bytef *)malloc(destLen);
if (!dest)
error("out of memory");
@@ -130,7 +130,7 @@ write_file(Bytef *source, uLongf sourceLen)
((double)timer_start.tv_sec + ((double)timer_start.tv_usec) / MICROSECOND);
if (report_once_flag) {
- HDfprintf(stdout, "\tCompression Ratio: %g\n", ((double)destLen) / (double)sourceLen);
+ fprintf(stdout, "\tCompression Ratio: %g\n", ((double)destLen) / (double)sourceLen);
report_once_flag = 0;
}
@@ -151,7 +151,7 @@ write_file(Bytef *source, uLongf sourceLen)
d_ptr += rc;
}
- HDfree(dest);
+ free(dest);
}
/*
@@ -211,9 +211,9 @@ get_unique_name(void)
if (prefix)
/* 2 = 1 for '/' + 1 for null terminator */
- filename = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(ZIP_PERF_FILE) + 2);
+ filename = (char *)malloc(HDstrlen(prefix) + HDstrlen(ZIP_PERF_FILE) + 2);
else
- filename = (char *)HDmalloc(HDstrlen(ZIP_PERF_FILE) + 1);
+ filename = (char *)malloc(HDstrlen(ZIP_PERF_FILE) + 1);
if (!filename)
error("out of memory");
@@ -235,30 +235,30 @@ get_unique_name(void)
static void
usage(void)
{
- HDfprintf(stdout, "usage: %s [OPTIONS]\n", prog);
- HDfprintf(stdout, " OPTIONS\n");
- HDfprintf(stdout, " -h, --help Print this usage message and exit\n");
- HDfprintf(stdout, " -1...-9 Level of compression, from 1 to 9\n");
- HDfprintf(stdout, " -c P, --compressability=P Percentage of compressability of the random\n");
- HDfprintf(stdout, " data you want [default: 0]");
- HDfprintf(stdout, " -s S, --file-size=S Maximum size of uncompressed file [default: 64M]\n");
- HDfprintf(stdout, " -B S, --max-buffer_size=S Maximum size of buffer [default: 1M]\n");
- HDfprintf(stdout, " -b S, --min-buffer_size=S Minimum size of buffer [default: 128K]\n");
- HDfprintf(stdout, " -p D, --prefix=D The directory prefix to place the file\n");
- HDfprintf(stdout, " -r, --random-test Use random data to write to the file\n");
- HDfprintf(stdout, " [default: no]\n");
- HDfprintf(stdout, "\n");
- HDfprintf(stdout, " D - a directory which exists\n");
- HDfprintf(stdout, " P - a number between 0 and 100\n");
- HDfprintf(stdout, " S - is a size specifier, an integer >=0 followed by a size indicator:\n");
- HDfprintf(stdout, "\n");
- HDfprintf(stdout, " K - Kilobyte (%d)\n", ONE_KB);
- HDfprintf(stdout, " M - Megabyte (%d)\n", ONE_MB);
- HDfprintf(stdout, " G - Gigabyte (%d)\n", ONE_GB);
- HDfprintf(stdout, "\n");
- HDfprintf(stdout, " Example: 37M = 37 Megabytes = %d bytes\n", 37 * ONE_MB);
- HDfprintf(stdout, "\n");
- HDfflush(stdout);
+ fprintf(stdout, "usage: %s [OPTIONS]\n", prog);
+ fprintf(stdout, " OPTIONS\n");
+ fprintf(stdout, " -h, --help Print this usage message and exit\n");
+ fprintf(stdout, " -1...-9 Level of compression, from 1 to 9\n");
+ fprintf(stdout, " -c P, --compressability=P Percentage of compressability of the random\n");
+ fprintf(stdout, " data you want [default: 0]");
+ fprintf(stdout, " -s S, --file-size=S Maximum size of uncompressed file [default: 64M]\n");
+ fprintf(stdout, " -B S, --max-buffer_size=S Maximum size of buffer [default: 1M]\n");
+ fprintf(stdout, " -b S, --min-buffer_size=S Minimum size of buffer [default: 128K]\n");
+ fprintf(stdout, " -p D, --prefix=D The directory prefix to place the file\n");
+ fprintf(stdout, " -r, --random-test Use random data to write to the file\n");
+ fprintf(stdout, " [default: no]\n");
+ fprintf(stdout, "\n");
+ fprintf(stdout, " D - a directory which exists\n");
+ fprintf(stdout, " P - a number between 0 and 100\n");
+ fprintf(stdout, " S - is a size specifier, an integer >=0 followed by a size indicator:\n");
+ fprintf(stdout, "\n");
+ fprintf(stdout, " K - Kilobyte (%d)\n", ONE_KB);
+ fprintf(stdout, " M - Megabyte (%d)\n", ONE_MB);
+ fprintf(stdout, " G - Gigabyte (%d)\n", ONE_GB);
+ fprintf(stdout, "\n");
+ fprintf(stdout, " Example: 37M = 37 Megabytes = %d bytes\n", 37 * ONE_MB);
+ fprintf(stdout, "\n");
+ fflush(stdout);
}
/*
@@ -319,7 +319,7 @@ fill_with_random_data(Bytef *src, uLongf src_len)
Bytef *buf = src;
int fd = HDopen("/dev/urandom", O_RDONLY, 0);
- HDfprintf(stdout, "Using /dev/urandom for random data\n");
+ fprintf(stdout, "Using /dev/urandom for random data\n");
if (fd < 0)
error(HDstrerror(errno));
@@ -339,7 +339,7 @@ fill_with_random_data(Bytef *src, uLongf src_len)
HDclose(fd);
}
else {
- HDfprintf(stdout, "Using random() for random data\n");
+ fprintf(stdout, "Using random() for random data\n");
for (u = 0; u < src_len; ++u)
src[u] = (Bytef)(0xff & HDrandom());
@@ -348,7 +348,7 @@ fill_with_random_data(Bytef *src, uLongf src_len)
if (compress_percent) {
size_t s = (size_t)((src_len * (uLongf)compress_percent) / 100);
- HDmemset(src, '\0', s);
+ memset(src, '\0', s);
}
}
@@ -364,7 +364,7 @@ do_write_test(unsigned long file_size, unsigned long min_buf_size, unsigned long
unsigned long i, iters;
iters = file_size / src_len;
- src = (Bytef *)HDcalloc(1, sizeof(Bytef) * src_len);
+ src = (Bytef *)calloc(1, sizeof(Bytef) * src_len);
if (!src) {
cleanup();
@@ -376,21 +376,21 @@ do_write_test(unsigned long file_size, unsigned long min_buf_size, unsigned long
if (random_test)
fill_with_random_data(src, src_len);
- HDfprintf(stdout, "Buffer size == ");
+ fprintf(stdout, "Buffer size == ");
if (src_len >= ONE_KB && (src_len % ONE_KB) == 0) {
if (src_len >= ONE_MB && (src_len % ONE_MB) == 0) {
- HDfprintf(stdout, "%ldMB", src_len / ONE_MB);
+ fprintf(stdout, "%ldMB", src_len / ONE_MB);
}
else {
- HDfprintf(stdout, "%ldKB", src_len / ONE_KB);
+ fprintf(stdout, "%ldKB", src_len / ONE_KB);
}
}
else {
- HDfprintf(stdout, "%ld", src_len);
+ fprintf(stdout, "%ld", src_len);
}
- HDfprintf(stdout, "\n");
+ fprintf(stdout, "\n");
/* do uncompressed data write */
HDgettimeofday(&timer_start, NULL);
@@ -424,8 +424,8 @@ do_write_test(unsigned long file_size, unsigned long min_buf_size, unsigned long
total_time = ((double)timer_stop.tv_sec + ((double)timer_stop.tv_usec) / (double)MICROSECOND) -
((double)timer_start.tv_sec + ((double)timer_start.tv_usec) / (double)MICROSECOND);
- HDfprintf(stdout, "\tUncompressed Write Time: %.2fs\n", total_time);
- HDfprintf(stdout, "\tUncompressed Write Throughput: %.2fMB/s\n", MB_PER_SEC(file_size, total_time));
+ fprintf(stdout, "\tUncompressed Write Time: %.2fs\n", total_time);
+ fprintf(stdout, "\tUncompressed Write Throughput: %.2fMB/s\n", MB_PER_SEC(file_size, total_time));
HDunlink(filename);
@@ -447,12 +447,12 @@ do_write_test(unsigned long file_size, unsigned long min_buf_size, unsigned long
total_time = ((double)timer_stop.tv_sec + ((double)timer_stop.tv_usec) / (double)MICROSECOND) -
((double)timer_start.tv_sec + ((double)timer_start.tv_usec) / (double)MICROSECOND);
- HDfprintf(stdout, "\tCompressed Write Time: %.2fs\n", total_time);
- HDfprintf(stdout, "\tCompressed Write Throughput: %.2fMB/s\n", MB_PER_SEC(file_size, total_time));
- HDfprintf(stdout, "\tCompression Time: %gs\n", compression_time);
+ fprintf(stdout, "\tCompressed Write Time: %.2fs\n", total_time);
+ fprintf(stdout, "\tCompressed Write Throughput: %.2fMB/s\n", MB_PER_SEC(file_size, total_time));
+ fprintf(stdout, "\tCompression Time: %gs\n", compression_time);
HDunlink(filename);
- HDfree(src);
+ free(src);
}
}
@@ -527,12 +527,12 @@ main(int argc, char *argv[])
if (min_buf_size > max_buf_size)
error("minimum buffer size (%d) exceeds maximum buffer size (%d)", min_buf_size, max_buf_size);
- HDfprintf(stdout, "Filesize: %ld\n", file_size);
+ fprintf(stdout, "Filesize: %ld\n", file_size);
if (compress_level == Z_DEFAULT_COMPRESSION)
- HDfprintf(stdout, "Compression Level: 6\n");
+ fprintf(stdout, "Compression Level: 6\n");
else
- HDfprintf(stdout, "Compression Level: %d\n", compress_level);
+ fprintf(stdout, "Compression Level: %d\n", compress_level);
get_unique_name();
do_write_test(file_size, min_buf_size, max_buf_size);
@@ -552,7 +552,7 @@ main(int argc, char *argv[])
int
main(void)
{
- HDfprintf(stdout, "No compression IO performance because zlib was not configured\n");
+ fprintf(stdout, "No compression IO performance because zlib was not configured\n");
return EXIT_SUCCESS;
}