aboutsummaryrefslogtreecommitdiffstats
path: root/vbench/src/tests/qps_analyzer/qps_analyzer_test.cpp
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@yahoo-inc.com>2016-06-15 23:09:44 +0200
committerJon Bratseth <bratseth@yahoo-inc.com>2016-06-15 23:09:44 +0200
commit72231250ed81e10d66bfe70701e64fa5fe50f712 (patch)
tree2728bba1131a6f6e5bdf95afec7d7ff9358dac50 /vbench/src/tests/qps_analyzer/qps_analyzer_test.cpp
Publish
Diffstat (limited to 'vbench/src/tests/qps_analyzer/qps_analyzer_test.cpp')
-rw-r--r--vbench/src/tests/qps_analyzer/qps_analyzer_test.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/vbench/src/tests/qps_analyzer/qps_analyzer_test.cpp b/vbench/src/tests/qps_analyzer/qps_analyzer_test.cpp
new file mode 100644
index 00000000000..4de340fcf29
--- /dev/null
+++ b/vbench/src/tests/qps_analyzer/qps_analyzer_test.cpp
@@ -0,0 +1,23 @@
+// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+#include <vespa/vespalib/testkit/testapp.h>
+#include <vbench/test/all.h>
+
+using namespace vbench;
+
+void post(double endTime, Handler<Request> &handler,
+ Request::Status status = Request::STATUS_OK)
+{
+ Request::UP req(new Request());
+ req->status(status).endTime(endTime);
+ handler.handle(std::move(req));
+}
+
+TEST_FF("simulate 100 qps", RequestSink(), QpsAnalyzer(f1)) {
+ for (size_t i = 1; i < 10000; ++i) {
+ post(i * 0.01, f2);
+ post(i * 0.01, f2, Request::STATUS_DROPPED);
+ post(i * 0.01, f2, Request::STATUS_FAILED);
+ }
+}
+
+TEST_MAIN() { TEST_RUN_ALL(); }