You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2008/08/26 18:04:56 UTC
svn commit: r689123 - in /incubator/qpid/trunk/qpid/cpp: Makefile.am
configure.ac qpidc.spec.in rpm/ src/tests/Makefile.am src/tests/echotest.cpp
Author: aconway
Date: Tue Aug 26 09:04:55 2008
New Revision: 689123
URL: http://svn.apache.org/viewvc?rev=689123&view=rev
Log:
Removed unused rpm targets and files.
Added src/tests/echotest.cpp from Gordon Sim.
Added:
incubator/qpid/trunk/qpid/cpp/src/tests/echotest.cpp (with props)
Removed:
incubator/qpid/trunk/qpid/cpp/qpidc.spec.in
incubator/qpid/trunk/qpid/cpp/rpm/
Modified:
incubator/qpid/trunk/qpid/cpp/Makefile.am
incubator/qpid/trunk/qpid/cpp/configure.ac
incubator/qpid/trunk/qpid/cpp/src/tests/Makefile.am
Modified: incubator/qpid/trunk/qpid/cpp/Makefile.am
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/Makefile.am?rev=689123&r1=689122&r2=689123&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/Makefile.am (original)
+++ incubator/qpid/trunk/qpid/cpp/Makefile.am Tue Aug 26 09:04:55 2008
@@ -1,12 +1,8 @@
AUTOMAKE_OPTIONS = 1.9.2 foreign
ACLOCAL_AMFLAGS = -I m4
-SPEC=$(PACKAGE).spec
-
EXTRA_DIST = \
LICENSE NOTICE README RELEASE_NOTES DESIGN\
- $(SPEC) $(SPEC).in \
- rpm/README.qpidd-devel \
xml/cluster.xml
SUBDIRS = managementgen etc src docs/api docs/man examples
@@ -15,24 +11,5 @@
libtool: $(LIBTOOL_DEPS)
$(SHELL) ./config.status --recheck
-#
-# Build RPMs from the distribution tarball.
-#
-RPMDIRS=rpm/BUILD rpm/RPMS rpm/SPECS rpm/SRPMS
-RPMMACROS=--define "_topdir @abs_builddir@/rpm" --define "_sourcedir @abs_builddir@"
-# Override this variable e.g. with -bs to produce srpm only
-RPMOPTS=-ba
-
-clean-local:
- -rm -rf $(RPMDIRS)
-
-.PHONY: rpmbuild
-
-rpmbuild: $(SPEC) dist-gzip
- mkdir -p $(RPMDIRS)
- QPID_PYTHON_DIR=@abs_top_srcdir@/../python rpmbuild $(RPMMACROS) $(RPMOPTS) $(SPEC)
-if HAS_RPMLINT
- rpmlint `find rpm -name '*.rpm'`
-else
- @echo "WARNING: rpmlint not found, could not validate RPMs."
-endif
+
+
Modified: incubator/qpid/trunk/qpid/cpp/configure.ac
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/configure.ac?rev=689123&r1=689122&r2=689123&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/configure.ac (original)
+++ incubator/qpid/trunk/qpid/cpp/configure.ac Tue Aug 26 09:04:55 2008
@@ -16,7 +16,6 @@
AC_PREREQ(2.59)
AC_CONFIG_HEADERS([src/config.h])
-AC_CONFIG_SRCDIR([qpidc.spec.in])
AC_PROG_CC_STDC
AM_PROG_CC_C_O
@@ -321,7 +320,6 @@
# Files to generate
AC_CONFIG_FILES([
- qpidc.spec
Makefile
examples/Makefile
examples/direct/Makefile
Modified: incubator/qpid/trunk/qpid/cpp/src/tests/Makefile.am
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/tests/Makefile.am?rev=689123&r1=689122&r2=689123&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/tests/Makefile.am (original)
+++ incubator/qpid/trunk/qpid/cpp/src/tests/Makefile.am Tue Aug 26 09:04:55 2008
@@ -99,6 +99,10 @@
latencytest_SOURCES=latencytest.cpp TestOptions.h ConnectionOptions.h
latencytest_LDADD=$(lib_client)
+check_PROGRAMS+=echotest
+echotest_SOURCES=echotest.cpp TestOptions.h ConnectionOptions.h
+echotest_LDADD=$(lib_client)
+
check_PROGRAMS+=client_test
client_test_SOURCES=client_test.cpp TestOptions.h ConnectionOptions.h
client_test_LDADD=$(lib_client)
Added: incubator/qpid/trunk/qpid/cpp/src/tests/echotest.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/tests/echotest.cpp?rev=689123&view=auto
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/tests/echotest.cpp (added)
+++ incubator/qpid/trunk/qpid/cpp/src/tests/echotest.cpp Tue Aug 26 09:04:55 2008
@@ -0,0 +1,131 @@
+#include <qpid/client/Connection.h>
+#include <qpid/client/SubscriptionManager.h>
+#include <qpid/client/Session.h>
+#include <qpid/client/Message.h>
+#include <qpid/client/MessageListener.h>
+#include <qpid/sys/Time.h>
+
+#include <iostream>
+
+using namespace qpid::client;
+using namespace qpid::framing;
+using namespace qpid::sys;
+using namespace std;
+
+struct Args : public qpid::Options,
+ public qpid::client::ConnectionSettings
+{
+ bool help;
+ uint count;
+ uint size;
+ bool summary;
+
+ Args() : qpid::Options("Simple latency test optins"), help(false), count(20), size(0), summary()
+ {
+ using namespace qpid;
+ addOptions()
+ ("help", optValue(help), "Print this usage statement")
+ ("count", optValue(count, "N"), "Number of messages to send")
+ ("size", optValue(count, "N"), "Size of messages")
+ ("broker,b", optValue(host, "HOST"), "Broker host to connect to")
+ ("port,p", optValue(port, "PORT"), "Broker port to connect to")
+ ("username", optValue(username, "USER"), "user name for broker log in.")
+ ("password", optValue(password, "PASSWORD"), "password for broker log in.")
+ ("mechanism", optValue(mechanism, "MECH"), "SASL mechanism to use when authenticating.")
+ ("tcp-nodelay", optValue(tcpNoDelay), "Turn on tcp-nodelay")
+ ("s,summary", optValue(summary), "Print only average latency.");
+ }
+};
+
+uint64_t current_time()
+{
+ Duration t(now());
+ return t;
+}
+
+class Listener : public MessageListener
+{
+ private:
+ Session session;
+ SubscriptionManager subscriptions;
+ uint counter;
+ const uint limit;
+ std::string queue;
+ Message request;
+ double total, min, max;
+ bool summary;
+
+ public:
+ Listener(Session& session, uint limit, bool summary);
+ void start(uint size);
+ void received(Message& message);
+};
+
+Listener::Listener(Session& s, uint l, bool summary_) :
+ session(s), subscriptions(s), counter(0), limit(l),
+ queue(session.getId().getName()), total(),
+ min(std::numeric_limits<double>::max()), max(), summary(summary_)
+{}
+
+void Listener::start(uint size)
+{
+ session.queueDeclare(arg::queue=queue, arg::exclusive=true, arg::autoDelete=true);
+ request.getDeliveryProperties().setRoutingKey(queue);
+ subscriptions.setAcceptMode(1/*not-required*/);
+ subscriptions.setFlowControl(SubscriptionManager::UNLIMITED, SubscriptionManager::UNLIMITED, false);
+ subscriptions.subscribe(*this, queue);
+
+ request.getDeliveryProperties().setTimestamp(current_time());
+ if (size) request.setData(std::string(size, 'X'));
+ async(session).messageTransfer(arg::content=request);
+ subscriptions.run();
+}
+
+void Listener::received(Message& response)
+{
+ //extract timestamp and compute latency:
+ uint64_t sentAt = response.getDeliveryProperties().getTimestamp();
+ uint64_t receivedAt = current_time();
+
+ double latency = ((double) (receivedAt - sentAt)) / TIME_MSEC;
+ if (!summary) cout << "Latency: " << latency << "ms" << endl;
+ min = std::min(latency, min);
+ max = std::max(latency, max);
+ total += latency;
+
+ if (++counter < limit) {
+ request.getDeliveryProperties().setTimestamp(current_time());
+ async(session).messageTransfer(arg::content=request);
+ } else {
+ subscriptions.cancel(queue);
+ if (summary) cout << min << " " << max << " " << total/limit << endl;
+ else cout << "min: " << min << " max: " << max << " average: " << total/limit << endl;
+ }
+}
+
+int main(int argc, char** argv)
+{
+ Args opts;
+ opts.parse(argc, argv);
+
+ if (opts.help) {
+ std::cout << opts << std::endl;
+ return 0;
+ }
+
+ Connection connection;
+ try {
+ connection.open(opts);
+ Session session = connection.newSession();
+ Listener listener(session, opts.count, opts.summary);
+ listener.start(opts.size);
+
+ connection.close();
+ return 0;
+ } catch(const std::exception& error) {
+ std::cout << error.what() << std::endl;
+ }
+ return 1;
+}
+
+
Propchange: incubator/qpid/trunk/qpid/cpp/src/tests/echotest.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/qpid/trunk/qpid/cpp/src/tests/echotest.cpp
------------------------------------------------------------------------------
svn:keywords = Rev Date