summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2015-01-20 01:27:47 +0100
committerRobin Gareus <robin@gareus.org>2015-01-20 01:27:47 +0100
commite6b696690ac00a4b0a02cfd302906af1cc18655d (patch)
tree12e87ea5a8d2cb24f5e1e22aa4e6f7331972edad /tools
parent899ee95ee0a953769ca537aa801f123357220c48 (diff)
readtest: print min/avg report at end
Diffstat (limited to 'tools')
-rw-r--r--tools/readtest.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/tools/readtest.c b/tools/readtest.c
index 41c3a444af..42e95ce3cb 100644
--- a/tools/readtest.c
+++ b/tools/readtest.c
@@ -126,6 +126,8 @@ main (int argc, char* argv[])
data = (char*) malloc (sizeof (char) * block_size);
uint64_t _read = 0;
+ double min_throughput = -1;
+ double total_time = 0;
while (true) {
gint64 before;
@@ -135,7 +137,7 @@ main (int argc, char* argv[])
if (read (files[n], (char*) data, block_size) != block_size) {
fprintf (stderr, "read failed on file %d (%s)\n", n, strerror (errno));
- return -1;
+ goto out;
}
}
@@ -144,6 +146,18 @@ main (int argc, char* argv[])
double bandwidth = ((nfiles * block_size)/1048576.0) / (elapsed/1000000.0);
printf ("BW @ %Lu %.3f seconds bandwidth %.4f MB/sec\n", _read, elapsed/1000000.0, bandwidth);
+
+ total_time += elapsed;
+ if (min_throughput > bandwidth || min_throughput < 0) {
+ min_throughput = bandwidth;
+ }
+
+ }
+
+out:
+ if (min_throughput > 0 && total_time > 0) {
+ double bandwidth = ((nfiles * _read)/1048576.0) / (total_time/1000000.0);
+ printf ("Min: %.4f MB/sec Avg: %.4f MB/sec\n", min_throughput, bandwidth);
}
return 0;