]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/onode-staged-tree: print more info with TreeBuilder
authorYingxin Cheng <yingxin.cheng@intel.com>
Wed, 23 Dec 2020 02:17:06 +0000 (10:17 +0800)
committerYingxin Cheng <yingxin.cheng@intel.com>
Thu, 24 Dec 2020 03:45:48 +0000 (11:45 +0800)
Signed-off-by: Yingxin Cheng <yingxin.cheng@intel.com>
src/crimson/os/seastore/onode_manager/staged-fltree/node_extent_manager.h
src/crimson/os/seastore/onode_manager/staged-fltree/node_extent_manager/dummy.h
src/crimson/os/seastore/onode_manager/staged-fltree/node_extent_manager/seastore.h
src/crimson/os/seastore/onode_manager/staged-fltree/tree.cc
src/crimson/os/seastore/onode_manager/staged-fltree/tree.h
src/crimson/os/seastore/onode_manager/staged-fltree/tree_utils.h
src/tools/crimson/perf_staged_fltree.cc

index a633633b04af21194a604c58ce6e3f3dac120cea..e8240384d718ee074a1a72957cb7150a9c92e376 100644 (file)
@@ -73,10 +73,14 @@ class NodeExtentManager {
       Transaction&, laddr_t, extent_len_t) = 0;
   virtual tm_future<NodeExtentRef> alloc_extent(Transaction&, extent_len_t) = 0;
   virtual tm_future<Super::URef> get_super(Transaction&, RootNodeTracker&) = 0;
+  virtual std::ostream& print(std::ostream& os) const = 0;
 
   static NodeExtentManagerURef create_dummy(bool is_sync);
   static NodeExtentManagerURef create_seastore(
       TransactionManager& tm, laddr_t min_laddr = L_ADDR_MIN);
 };
+inline std::ostream& operator<<(std::ostream& os, const NodeExtentManager& nm) {
+  return nm.print(os);
+}
 
 }
index 9a9975bf31530aa7479a587158b3d58a603f6155..604af37efcd5c483532620cd1015ff90deccc755 100644 (file)
@@ -105,6 +105,10 @@ class DummyNodeExtentManager final: public NodeExtentManager {
     }
   }
 
+  std::ostream& print(std::ostream& os) const override {
+    return os << "DummyNodeExtentManager(sync=" << SYNC << ")";
+  }
+
  private:
   tm_future<NodeExtentRef> read_extent_sync(
       Transaction& t, laddr_t addr, extent_len_t len) {
index 99e75791260ca2c26bf8b153e7d3584252489882..f80b99fabe008023f1173e6196e3d03be34c47f9 100644 (file)
@@ -110,6 +110,11 @@ class SeastoreNodeExtentManager final: public NodeExtentManager {
       return Super::URef(new SeastoreSuper(t, tracker, root_addr, tm));
     });
   }
+
+  std::ostream& print(std::ostream& os) const override {
+    return os << "SeastoreNodeExtentManager";
+  }
+
  private:
   static seastar::logger& logger() {
     return crimson::get_logger(ceph_subsys_filestore);
index a4e7ef451f49cbeffa845e77b8fdf75047a36db4..680bfa9cb683eaef8dfb11a0b36782d197577c53 100644 (file)
@@ -204,6 +204,10 @@ std::ostream& Btree::dump(Transaction& t, std::ostream& os) {
   return os;
 }
 
+std::ostream& Btree::print(std::ostream& os) const {
+  return os << "BTree-" << *nm;
+}
+
 btree_future<Ref<Node>> Btree::get_root(Transaction& t) {
   auto root = root_tracker->get_root(t);
   if (root) {
index 7276303fba48676e3445d917508cd37f39d73716..170ae2532827fe3b31eeee6be846b716c03178d5 100644 (file)
@@ -67,6 +67,7 @@ class Btree {
   btree_future<size_t> height(Transaction&);
   btree_future<tree_stats_t> get_stats_slow(Transaction&);
   std::ostream& dump(Transaction&, std::ostream&);
+  std::ostream& print(std::ostream& os) const;
 
   // test_only
   bool test_is_clean() const;
@@ -81,6 +82,9 @@ class Btree {
 
   friend class DummyChildPool;
 };
+inline std::ostream& operator<<(std::ostream& os, const Btree& tree) {
+  return tree.print(os);
+}
 
 class tree_cursor_t;
 class Btree::Cursor {
index f970955106da38f2b1624e6ff46aac200c743ccd..fb61abef3543f68534494de4119e74a1f2de5565 100644 (file)
@@ -200,24 +200,31 @@ class TreeBuilder {
     : kvs{kvs}, tree{std::move(nm)} {}
 
   future<> bootstrap(Transaction& t) {
-    return tree.mkfs(t);
-  }
-
-  future<> insert(Transaction& t) {
     std::ostringstream oss;
 #ifndef NDEBUG
-    oss << "debug on, ";
+    oss << "debug=on, ";
+#else
+    oss << "debug=off, ";
+#endif
+#ifdef UNIT_TESTS_BUILT
+    oss << "UNIT_TEST_BUILT=on, ";
 #else
-    oss << "debug off, ";
+    oss << "UNIT_TEST_BUILT=off, ";
 #endif
     if constexpr (TRACK) {
-      oss << "track on";
+      oss << "track=on, ";
     } else {
-      oss << "track off";
+      oss << "track=off, ";
     }
+    oss << tree;
+    logger().warn("TreeBuilder: {}, bootstrapping ...", oss.str());
+    return tree.mkfs(t);
+  }
+
+  future<> insert(Transaction& t) {
     kv_iter = kvs.random_begin();
     auto cursors = seastar::make_lw_shared<std::vector<Btree::Cursor>>();
-    logger().warn("start inserting {} kvs ({}) ...", kvs.size(), oss.str());
+    logger().warn("start inserting {} kvs ...", kvs.size());
     auto start_time = mono_clock::now();
     return crimson::do_until([&t, this, cursors]() -> future<bool> {
       if (kv_iter.is_end()) {
index 33ecea3602f0d0945ba7c77afc32ec419923a70f..2e9315e9d385ea41e93a93436e15be65cde268ab 100644 (file)
@@ -6,6 +6,7 @@
 #include <seastar/core/app-template.hh>
 #include <seastar/core/thread.hh>
 
+#include "crimson/common/log.h"
 #include "crimson/os/seastore/onode_manager/staged-fltree/tree_utils.h"
 #include "crimson/os/seastore/onode_manager/staged-fltree/node_extent_manager.h"
 #include "test/crimson/seastore/transaction_manager_test_state.h"
 using namespace crimson::os::seastore::onode;
 namespace bpo = boost::program_options;
 
+seastar::logger& logger() {
+  return crimson::get_logger(ceph_subsys_test);
+}
+
 template <bool TRACK>
 class PerfTree : public TMTestState {
  public:
@@ -32,7 +37,10 @@ class PerfTree : public TMTestState {
         {
           auto t = tm->create_transaction();
           tree->insert(*t).unsafe_get();
+          auto start_time = mono_clock::now();
           tm->submit_transaction(std::move(t)).unsafe_get();
+          std::chrono::duration<double> duration = mono_clock::now() - start_time;
+          logger().warn("submit_transaction() done! {}s", duration.count());
         }
         {
           auto t = tm->create_transaction();