summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2012-06-18 15:19:27 +0000
committerGordon Sim <gsim@apache.org>2012-06-18 15:19:27 +0000
commitd12bd01595f65512f523106fb09570a4ab80a7d1 (patch)
tree014088593ff8d3b609827bd0fd079bab6c7fb6e8
parentdbe3c9e52a9fb483e44d7915a965b42af3f46589 (diff)
downloadqpid-python-d12bd01595f65512f523106fb09570a4ab80a7d1.tar.gz
QPID-4030: Check send rate actually achieved and report if it fails to match the desired rate
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1351386 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--qpid/cpp/src/tests/qpid-latency-test.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/qpid/cpp/src/tests/qpid-latency-test.cpp b/qpid/cpp/src/tests/qpid-latency-test.cpp
index 20eb4568f3..2343cb1d77 100644
--- a/qpid/cpp/src/tests/qpid-latency-test.cpp
+++ b/qpid/cpp/src/tests/qpid-latency-test.cpp
@@ -359,19 +359,29 @@ void Sender::sendByRate()
}
uint64_t interval = TIME_SEC/opts.rate;
int64_t timeLimit = opts.timeLimit * TIME_SEC;
- uint64_t sent = 0, missedRate = 0;
+ uint64_t sent = 0;
AbsTime start = now();
+ AbsTime last = start;
while (true) {
AbsTime sentAt=now();
msg.getDeliveryProperties().setTimestamp(Duration(EPOCH, sentAt));
async(session).messageTransfer(arg::content=msg, arg::acceptMode=1);
if (opts.sync) session.sync();
++sent;
+ if (Duration(last, sentAt) > TIME_SEC*2) {
+ Duration t(start, now());
+ //check rate actually achieved thus far
+ uint actualRate = sent / (t/TIME_SEC);
+ //report inability to stay within 1% of desired rate
+ if (actualRate < opts.rate && opts.rate - actualRate > opts.rate/100) {
+ std::cerr << "WARNING: Desired send rate: " << opts.rate << ", actual send rate: " << actualRate << std::endl;
+ }
+ last = sentAt;
+ }
+
AbsTime waitTill(start, sent*interval);
Duration delay(sentAt, waitTill);
- if (delay < 0)
- ++missedRate;
- else
+ if (delay > 0)
sys::usleep(delay / TIME_USEC);
if (timeLimit != 0 && Duration(start, now()) > timeLimit) {
session.sync();