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 | 3fd23a22a915e11ce76dd40ca55f2842458d63c9 (patch) | |
tree | 7fa5c9d39e4498a13ef2d640626f86dcf6ae7de0 | |
parent | b5f36d31202e4dd4395a9b69078b39589b849d20 (diff) | |
download | qpid-python-3fd23a22a915e11ce76dd40ca55f2842458d63c9.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/qpid@1076652 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | cpp/src/tests/qpid-perftest.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/cpp/src/tests/qpid-perftest.cpp b/cpp/src/tests/qpid-perftest.cpp index 4d7b563c8c..8a5cf05775 100644 --- a/cpp/src/tests/qpid-perftest.cpp +++ b/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")); |