ls.back()->h.push_back(2);
}
+void filestore_perf_stat_t::dump(Formatter *f) const
+{
+ f->dump_unsigned("commit_latency_ms", filestore_commit_latency);
+ f->dump_unsigned("apply_latency_ms", filestore_apply_latency);
+}
+
+void filestore_perf_stat_t::encode(bufferlist &bl) const
+{
+ ENCODE_START(1, 1, bl);
+ ::encode(filestore_commit_latency, bl);
+ ::encode(filestore_apply_latency, bl);
+ ENCODE_FINISH(bl);
+}
+
+void filestore_perf_stat_t::decode(bufferlist::iterator &bl)
+{
+ DECODE_START(1, bl);
+ ::decode(filestore_commit_latency, bl);
+ ::decode(filestore_apply_latency, bl);
+ DECODE_FINISH(bl);
+}
+
+void filestore_perf_stat_t::generate_test_instances(std::list<filestore_perf_stat_t*>& o)
+{
+ o.push_back(new filestore_perf_stat_t());
+ o.push_back(new filestore_perf_stat_t());
+ o.back()->filestore_commit_latency = 20;
+ o.back()->filestore_apply_latency = 30;
+}
+
// -- osd_stat_t --
void osd_stat_t::dump(Formatter *f) const
{
f->open_object_section("op_queue_age_hist");
op_queue_age_hist.dump(f);
f->close_section();
+ f->open_object_section("fs_perf_stat");
+ fs_perf_stat.dump(f);
+ f->close_section();
}
void osd_stat_t::encode(bufferlist &bl) const
{
- ENCODE_START(3, 2, bl);
+ ENCODE_START(4, 2, bl);
::encode(kb, bl);
::encode(kb_used, bl);
::encode(kb_avail, bl);
::encode(hb_in, bl);
::encode(hb_out, bl);
::encode(op_queue_age_hist, bl);
+ ::encode(fs_perf_stat, bl);
ENCODE_FINISH(bl);
}
void osd_stat_t::decode(bufferlist::iterator &bl)
{
- DECODE_START_LEGACY_COMPAT_LEN(3, 2, 2, bl);
+ DECODE_START_LEGACY_COMPAT_LEN(4, 2, 2, bl);
::decode(kb, bl);
::decode(kb_used, bl);
::decode(kb_avail, bl);
::decode(hb_out, bl);
if (struct_v >= 3)
::decode(op_queue_age_hist, bl);
+ if (struct_v >= 4)
+ ::decode(fs_perf_stat, bl);
DECODE_FINISH(bl);
}
};
WRITE_CLASS_ENCODER(pow2_hist_t)
+/**
+ * filestore_perf_stat_t
+ *
+ * current perf information about the osd
+ */
+struct filestore_perf_stat_t {
+ // cur_op_latency is in ms since double add/sub are not associative
+ uint32_t filestore_commit_latency;
+ uint32_t filestore_apply_latency;
+
+ filestore_perf_stat_t() :
+ filestore_commit_latency(0), filestore_apply_latency(0) {}
+
+ void add(const filestore_perf_stat_t &o) {
+ filestore_commit_latency += o.filestore_commit_latency;
+ filestore_apply_latency += o.filestore_apply_latency;
+ }
+ void sub(const filestore_perf_stat_t &o) {
+ filestore_commit_latency -= o.filestore_commit_latency;
+ filestore_apply_latency -= o.filestore_apply_latency;
+ }
+ void dump(Formatter *f) const;
+ void encode(bufferlist &bl) const;
+ void decode(bufferlist::iterator &bl);
+ static void generate_test_instances(std::list<filestore_perf_stat_t*>& o);
+};
+WRITE_CLASS_ENCODER(filestore_perf_stat_t)
+
/** osd_stat
* aggregate stats for an osd
*/
pow2_hist_t op_queue_age_hist;
+ filestore_perf_stat_t fs_perf_stat;
+
osd_stat_t() : kb(0), kb_used(0), kb_avail(0),
snap_trim_queue_len(0), num_snap_trimming(0) {}
snap_trim_queue_len += o.snap_trim_queue_len;
num_snap_trimming += o.num_snap_trimming;
op_queue_age_hist.add(o.op_queue_age_hist);
+ fs_perf_stat.add(o.fs_perf_stat);
}
void sub(const osd_stat_t& o) {
kb -= o.kb;
snap_trim_queue_len -= o.snap_trim_queue_len;
num_snap_trimming -= o.num_snap_trimming;
op_queue_age_hist.sub(o.op_queue_age_hist);
+ fs_perf_stat.sub(o.fs_perf_stat);
}
void dump(Formatter *f) const;