qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cctriel...@apache.org
Subject svn commit: r732071 - /qpid/trunk/qpid/cpp/src/tests/perftest.cpp
Date Tue, 06 Jan 2009 19:30:45 GMT
Author: cctrieloff
Date: Tue Jan  6 11:30:44 2009
New Revision: 732071

URL: http://svn.apache.org/viewvc?rev=732071&view=rev
Log:
Add option to use single connection for all producers, and consumers to test high queue count
configurations without using many physical connections.

Modified:
    qpid/trunk/qpid/cpp/src/tests/perftest.cpp

Modified: qpid/trunk/qpid/cpp/src/tests/perftest.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/perftest.cpp?rev=732071&r1=732070&r2=732071&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/perftest.cpp (original)
+++ qpid/trunk/qpid/cpp/src/tests/perftest.cpp Tue Jan  6 11:30:44 2009
@@ -92,6 +92,7 @@
 
     // General
     size_t qt;
+    bool singleConnect;
     size_t iterations;
     Mode mode;
     bool summary;
@@ -109,7 +110,7 @@
         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 @@
              "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 @@
 "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;
         }



Mime
View raw message