X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=tools%2Freadtest.c;fp=tools%2Freadtest.c;h=42e95ce3cb06137d446baf73e2ce92dce9fadd45;hb=e6b696690ac00a4b0a02cfd302906af1cc18655d;hp=41c3a444af2ce6b2d3ebda2083b6a8249a6a0430;hpb=899ee95ee0a953769ca537aa801f123357220c48;p=ardour.git 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;