diff options
author | Carl C. Trieloff <cctrieloff@apache.org> | 2009-01-06 19:30:44 +0000 |
---|---|---|
committer | Carl C. Trieloff <cctrieloff@apache.org> | 2009-01-06 19:30:44 +0000 |
commit | 9b18a2b17aaa643001c54d48445ed0d8bb7f2a4c (patch) | |
tree | 054da64c5a6d5115125b170f73e68d9f9de9a681 /cpp/src/tests | |
parent | a66c241b7d30520d44be93a38ee90fb4999515e8 (diff) | |
download | qpid-python-9b18a2b17aaa643001c54d48445ed0d8bb7f2a4c.tar.gz |
Add option to use single connection for all producers, and consumers to test high queue count configurations without using many physical connections.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@732071 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/tests')
-rw-r--r-- | cpp/src/tests/perftest.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/cpp/src/tests/perftest.cpp b/cpp/src/tests/perftest.cpp index be9ffd846e..7c8bfe1e8b 100644 --- a/cpp/src/tests/perftest.cpp +++ b/cpp/src/tests/perftest.cpp @@ -92,6 +92,7 @@ struct Opts : public TestOptions { // General size_t qt; + bool singleConnect; size_t iterations; Mode mode; bool summary; @@ -109,7 +110,7 @@ struct Opts : public TestOptions { setup(false), control(false), publish(false), subscribe(false), pubs(1), count(500000), size(1024), confirm(true), durable(false), uniqueData(false), syncPub(false), subs(1), ack(0), - qt(1), iterations(1), mode(SHARED), summary(false), + qt(1),singleConnect(false), iterations(1), mode(SHARED), summary(false), intervalSub(0), intervalPub(0), tx(0), txPub(0), txSub(0), commitAsync(false) { addOptions() @@ -136,6 +137,8 @@ struct Opts : public TestOptions { "N==0: Subscriber uses unconfirmed mode") ("qt", optValue(qt, "N"), "Create N queues or topics.") + ("single-connection", optValue(singleConnect, "yes|no"), "Use one connection for multiple sessions.") + ("iterations", optValue(iterations, "N"), "Desired number of iterations of the test.") ("summary,s", optValue(summary), "Summary output: pubs/sec subs/sec transfers/sec Mbytes/sec") @@ -214,21 +217,29 @@ const std::string Opts::helpText= "Note the <other options> must be identical for all processes.\n"; Opts opts; +Connection globalConnection; struct Client : public Runnable { - Connection connection; + Connection* connection; + Connection localConnection; AsyncSession session; Thread thread; Client() { - opts.open(connection); - session = connection.newSession(); + if (opts.singleConnect){ + connection = &globalConnection; + if (!globalConnection.isOpen()) opts.open(globalConnection); + }else{ + connection = &localConnection; + opts.open(localConnection); + } + session = connection->newSession(); } ~Client() { try { session.close(); - connection.close(); + connection->close(); } catch (const std::exception& e) { std::cerr << "Error in shutdown: " << e.what() << std::endl; } |