]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
include/frag: add a dump() method to fragtree_t
authorJohn Spray <john.spray@redhat.com>
Tue, 17 Mar 2015 17:47:50 +0000 (17:47 +0000)
committerJohn Spray <john.spray@redhat.com>
Thu, 19 Mar 2015 21:27:34 +0000 (21:27 +0000)
Signed-off-by: John Spray <john.spray@redhat.com>
src/include/frag.h

index 1b4716422de5f125eb86e382f206a0d524171850..7e0d4a8eefb7b33ec483346464f13dfadffc2b92 100644 (file)
@@ -498,6 +498,21 @@ public:
     }
     out << ")";
   }
+
+  void dump(Formatter *f) const {
+    f->open_array_section("splits");
+    for (compact_map<frag_t,int32_t>::const_iterator p = _splits.begin();
+         p != _splits.end();
+         ++p) {
+      f->open_object_section("split");
+      std::ostringstream frag_str;
+      frag_str << p->first;
+      f->dump_string("frag", frag_str.str());
+      f->dump_int("children", p->second);
+      f->close_section(); // split
+    }
+    f->close_section(); // splits
+  }
 };
 WRITE_CLASS_ENCODER(fragtree_t)