]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
neorados: Completion handling benchmark
authorAdam C. Emerson <aemerson@redhat.com>
Tue, 6 Aug 2019 19:30:57 +0000 (15:30 -0400)
committerAdam C. Emerson <aemerson@redhat.com>
Fri, 15 May 2020 14:55:10 +0000 (10:55 -0400)
Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
src/test/neorados/CMakeLists.txt
src/test/neorados/completions.cc [new file with mode: 0644]

index 38f7ae4b056a3e693a95c6b427724320d1bb736b..c9a506a11602af909b2e07cf67f9e3b8b0526223 100644 (file)
@@ -1,2 +1,6 @@
 add_executable(ceph_test_neorados_start_stop start_stop.cc)
 target_link_libraries(ceph_test_neorados_start_stop global libneorados ${unittest_libs})
+
+add_executable(ceph_test_neorados_completions completions.cc)
+target_link_libraries(ceph_test_neorados_completions Boost::system pthread
+  ${unittest_libs})
diff --git a/src/test/neorados/completions.cc b/src/test/neorados/completions.cc
new file mode 100644 (file)
index 0000000..d9c0e08
--- /dev/null
@@ -0,0 +1,20 @@
+#include <cassert>
+#include <boost/asio.hpp>
+#include <boost/system/system_error.hpp>
+
+constexpr int max_completions = 10'000'000;
+int completed = 0;
+
+boost::asio::io_context c;
+
+void nested_cb() {
+  if (++completed < max_completions)
+    c.post(&nested_cb);
+}
+
+int main(void) {
+  c.post(&nested_cb);
+  c.run();
+  assert(completed == max_completions);
+  return 0;
+}