include/frag: add a dump() method to fragtree_t

Signed-off-by: John Spray <john.spray@redhat.com>
This commit is contained in:
John Spray 2015-03-17 17:47:50 +00:00
parent 62ee84eb36
commit 842a4c32d3

View 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)