From 38be6d3fb8785c23f9cf76754aa956dd0e999996 Mon Sep 17 00:00:00 2001 From: "Adam C. Emerson" Date: Tue, 6 Aug 2019 16:19:12 -0400 Subject: [PATCH] librados: Op creation benchmark Signed-off-by: Adam C. Emerson --- src/test/librados/CMakeLists.txt | 5 +++++ src/test/librados/op_speed.cc | 22 ++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 src/test/librados/op_speed.cc diff --git a/src/test/librados/CMakeLists.txt b/src/test/librados/CMakeLists.txt index d5a99bd2a32..14962e84d27 100644 --- a/src/test/librados/CMakeLists.txt +++ b/src/test/librados/CMakeLists.txt @@ -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 index 00000000000..90c7bdac571 --- /dev/null +++ b/src/test/librados/op_speed.cc @@ -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 xattrs; + std::map 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); + } +} -- 2.39.5