From: Adam C. Emerson Date: Tue, 6 Aug 2019 20:19:12 +0000 (-0400) Subject: librados: Op creation benchmark X-Git-Tag: v16.1.0~2266^2~22 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=38be6d3fb8785c23f9cf76754aa956dd0e999996;p=ceph.git librados: Op creation benchmark Signed-off-by: Adam C. Emerson --- diff --git a/src/test/librados/CMakeLists.txt b/src/test/librados/CMakeLists.txt index d5a99bd2a32d..14962e84d27a 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 000000000000..90c7bdac571b --- /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); + } +}