diff options
author | Charles E. Rolke <chug@apache.org> | 2011-03-03 15:27:11 +0000 |
---|---|---|
committer | Charles E. Rolke <chug@apache.org> | 2011-03-03 15:27:11 +0000 |
commit | 2736513ae2302ff6e960a4e9571cc41fe11d1b6b (patch) | |
tree | 6fde74a13403ae8a9731b892811e958746a894c2 | |
parent | 369c89951adb0338f3b6c6a7783c4217f3087d5f (diff) | |
download | qpid-python-2736513ae2302ff6e960a4e9571cc41fe11d1b6b.tar.gz |
NO-JIRA Fix a degenerate test case where the message count is small
and the host system timing base yields and elapsed time of zero.
The change is to throw a meaningful error message rather than throwing
an obscure DIV0 error.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1076652 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | qpid/cpp/src/tests/qpid-perftest.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/qpid/cpp/src/tests/qpid-perftest.cpp b/qpid/cpp/src/tests/qpid-perftest.cpp index 4d7b563c8c..8a5cf05775 100644 --- a/qpid/cpp/src/tests/qpid-perftest.cpp +++ b/qpid/cpp/src/tests/qpid-perftest.cpp @@ -423,8 +423,10 @@ struct Controller : public Client { process(opts.totalSubs, subDone, fqn("sub_done"), boost::ref(subRates)); AbsTime end=now(); - double time=secs(start, end); + if (time <= 0.0) { + throw Exception("ERROR: Test completed in zero seconds. Try again with a larger message count."); + } double txrate=opts.transfers/time; double mbytes=(txrate*opts.size)/(1024*1024); @@ -543,6 +545,9 @@ struct PublishThread : public Client { if (opts.confirm) session.sync(); AbsTime end=now(); double time=secs(start,end); + if (time <= 0.0) { + throw Exception("ERROR: Test completed in zero seconds. Try again with a larger message count."); + } // Send result to controller. Message report(lexical_cast<string>(opts.count/time), fqn("pub_done")); |