From 2736513ae2302ff6e960a4e9571cc41fe11d1b6b Mon Sep 17 00:00:00 2001 From: "Charles E. Rolke" Date: Thu, 3 Mar 2011 15:27:11 +0000 Subject: 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 --- qpid/cpp/src/tests/qpid-perftest.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'qpid/cpp/src') 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(opts.count/time), fqn("pub_done")); -- cgit v1.2.1