summaryrefslogtreecommitdiff
path: root/qpid/cpp/src/tests/perftest.cpp
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2007-11-28 20:17:55 +0000
committerAlan Conway <aconway@apache.org>2007-11-28 20:17:55 +0000
commit2665a7c4d0a991094b5a7a43f026f76691a441e8 (patch)
tree522054a5028a0f5e3c4b643c61bd7488c2467fd0 /qpid/cpp/src/tests/perftest.cpp
parent906a68c99e528b0e601294bea9dbb812c0c175ac (diff)
downloadqpid-python-2665a7c4d0a991094b5a7a43f026f76691a441e8.tar.gz
Add unit_test.h to distribution.
Updated/removed sundry FIXME comments. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@599128 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src/tests/perftest.cpp')
-rw-r--r--qpid/cpp/src/tests/perftest.cpp26
1 files changed, 20 insertions, 6 deletions
diff --git a/qpid/cpp/src/tests/perftest.cpp b/qpid/cpp/src/tests/perftest.cpp
index da0eaf0f8a..8439da6b5d 100644
--- a/qpid/cpp/src/tests/perftest.cpp
+++ b/qpid/cpp/src/tests/perftest.cpp
@@ -334,6 +334,7 @@ struct Controller : public Client {
}
};
+
struct PublishThread : public Client {
string destination;
string routingKey;
@@ -419,19 +420,32 @@ struct SubscribeThread : public Client {
Message msg;
AbsTime start=now();
+ size_t lastMsg=0;
for (size_t i = 0; i < opts.subQuota; ++i) {
msg=lq.pop();
- // FIXME aconway 2007-11-23: Verify message sequence numbers.
- // Need an array of counters, one per publisher and need
- // publisher ID in the message for multiple publishers.
+ // TODO aconway 2007-11-23: check message sequence for
+ // multiple publishers. Need an array of counters,
+ // one per publisher and a publisher ID in the
+ // message. Careful not to introduce a lot of overhead
+ // here, e.g. no std::map, std::string etc.
+ //
+ // For now verify order only for a single publisher.
+ if (opts.pubs == 1) {
+ char* data = const_cast<char*>(msg.getData().data());
+ size_t n = *reinterpret_cast<uint32_t*>(data);
+ if (n < lastMsg) {
+ // Report to control.
+ Message error("Out-of-sequence messages", "sub_done");
+ session.messageTransfer(arg::content=error);
+ return;
+ }
+ lastMsg=n;
+ }
}
if (opts.ack !=0)
msg.acknowledge(); // Cumulative ack for final batch.
AbsTime end=now();
- // FIXME aconway 2007-11-23: close the subscription,
- // release any pending messages.
-
// Report to publisher.
Message result(lexical_cast<string>(opts.subQuota/secs(start,end)),
"sub_done");