]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librados: Op creation benchmark
authorAdam C. Emerson <aemerson@redhat.com>
Tue, 6 Aug 2019 20:19:12 +0000 (16:19 -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/librados/CMakeLists.txt
src/test/librados/op_speed.cc [new file with mode: 0644]

index d5a99bd2a32d72ad4837375bdbcf1a8ddba2c714..14962e84d27a3bbf6024688db20cfbadaf5da42c 100644 (file)
@@ -194,3 +194,8 @@ add_executable(ceph_test_rados_completion_speed
   completion_speed.cc)
 target_link_libraries(ceph_test_rados_completion_speed
   librados ${UNITTEST_LIBS} radostest-cxx)
+
+add_executable(ceph_test_rados_op_speed
+  op_speed.cc)
+target_link_libraries(ceph_test_rados_op_speed
+  librados ${UNITTEST_LIBS} radostest-cxx)
diff --git a/src/test/librados/op_speed.cc b/src/test/librados/op_speed.cc
new file mode 100644 (file)
index 0000000..90c7bda
--- /dev/null
@@ -0,0 +1,22 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*
+// vim: ts=8 sw=2 smarttab
+
+#include "include/rados/librados.hpp"
+
+constexpr int to_create = 10'000'000;
+
+int main() {
+  for (int i = 0; i < to_create; ++i) {
+    librados::ObjectReadOperation op;
+    bufferlist bl;
+    std::uint64_t sz;
+    struct timespec tm;
+    std::map<std::string, ceph::buffer::list> xattrs;
+    std::map<std::string, ceph::buffer::list> omap;
+    bool more;
+    op.read(0, 0, &bl, nullptr);
+    op.stat2(&sz, &tm, nullptr);
+    op.getxattrs(&xattrs, nullptr);
+    op.omap_get_vals2({}, 1000, &omap, &more, nullptr);
+  }
+}