You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ch...@apache.org on 2011/03/03 16:27:11 UTC
svn commit: r1076652 - /qpid/trunk/qpid/cpp/src/tests/qpid-perftest.cpp
Author: chug
Date: Thu Mar 3 15:27:11 2011
New Revision: 1076652
URL: http://svn.apache.org/viewvc?rev=1076652&view=rev
Log:
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.
Modified:
qpid/trunk/qpid/cpp/src/tests/qpid-perftest.cpp
Modified: qpid/trunk/qpid/cpp/src/tests/qpid-perftest.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/qpid-perftest.cpp?rev=1076652&r1=1076651&r2=1076652&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/qpid-perftest.cpp (original)
+++ qpid/trunk/qpid/cpp/src/tests/qpid-perftest.cpp Thu Mar 3 15:27:11 2011
@@ -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"));
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org