From: Igor Fedotov Date: Thu, 22 Jun 2023 10:10:34 +0000 (+0300) Subject: test/allocator_replay: print elapsed time for try_alloc command X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=791c3e524569b1f07e8d2a9a9e2b5b9ef55c208b;p=ceph.git test/allocator_replay: print elapsed time for try_alloc command Signed-off-by: Igor Fedotov --- diff --git a/src/test/objectstore/allocator_replay_test.cc b/src/test/objectstore/allocator_replay_test.cc index 7d0d9420f6be..4229abe89c4c 100644 --- a/src/test/objectstore/allocator_replay_test.cc +++ b/src/test/objectstore/allocator_replay_test.cc @@ -622,14 +622,25 @@ int main(int argc, char **argv) std::cout << "Free: 0x" << std::hex << a->get_free() << std::dec << std::endl; { + auto t00 = ceph::mono_clock::now(); PExtentVector extents; for(size_t i = 0; i < count; i++) { extents.clear(); + auto t0 = ceph::mono_clock::now(); auto r = a->allocate(want, alloc_unit, 0, &extents); + std::cout << "Duration (ns): " << (ceph::mono_clock::now() - t0).count() << std::endl; if (r < 0) { std::cerr << "Error: allocation failure at step:" << i + 1 - << ", ret = " << r << std::endl; - return -1; + << ", ret = " << r + << " elapsed (ns): " << (ceph::mono_clock::now() - t00).count() + << std::endl; + return -1; + } else if ((size_t)r < want) { + std::cerr << "Error: allocation failure at step:" << i + 1 + << ", allocated " << r << " of " << want + << " elapsed (ns): " << (ceph::mono_clock::now() - t00).count() + << std::endl; + return -1; } std::cout << ">allocated: " << r << std::endl; @@ -639,9 +650,11 @@ int main(int argc, char **argv) } std::cout << std::dec << std::endl; } + std::cout << "Successfully allocated: " << count << " * " << want + << ", unit:" << alloc_unit + << " elapsed (ns): " << (ceph::mono_clock::now() - t00).count() + << std::endl; } - std::cout << "Successfully allocated: " << count << " * " << want - << ", unit:" << alloc_unit << std::endl; return 0; }); } else if (strcmp(argv[2], "replay_alloc") == 0) {