diff options
author | Samuel Just <sam.just@inktank.com> | 2013-08-13 17:21:39 -0700 |
---|---|---|
committer | Samuel Just <sam.just@inktank.com> | 2013-08-13 17:37:24 -0700 |
commit | 95f3353a6ab3a4dd2bf28eaca7122487942e913e (patch) | |
tree | 8a3863758d5a13ecb0cd7ebda97986877fce758b | |
parent | 2632846e24e3c26139e982e0a569951d25e1589b (diff) | |
download | ceph-95f3353a6ab3a4dd2bf28eaca7122487942e913e.tar.gz |
osd_types: add osd_perf_stat_t type
Signed-off-by: Samuel Just <sam.just@inktank.com>
-rw-r--r-- | src/osd/osd_types.cc | 40 | ||||
-rw-r--r-- | src/osd/osd_types.h | 32 | ||||
-rw-r--r-- | src/test/encoding/types.h | 1 |
3 files changed, 71 insertions, 2 deletions
diff --git a/src/osd/osd_types.cc b/src/osd/osd_types.cc index 0e8ecb99086..ea3e5d5c3eb 100644 --- a/src/osd/osd_types.cc +++ b/src/osd/osd_types.cc @@ -136,6 +136,36 @@ void pow2_hist_t::generate_test_instances(list<pow2_hist_t*>& ls) 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 { @@ -155,11 +185,14 @@ 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); @@ -168,12 +201,13 @@ void osd_stat_t::encode(bufferlist &bl) const ::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); @@ -183,6 +217,8 @@ void osd_stat_t::decode(bufferlist::iterator &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); } diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h index bf04e8e11e3..3cafdc2b035 100644 --- a/src/osd/osd_types.h +++ b/src/osd/osd_types.h @@ -569,6 +569,34 @@ public: }; 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 */ @@ -579,6 +607,8 @@ struct osd_stat_t { 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) {} @@ -589,6 +619,7 @@ struct osd_stat_t { 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; @@ -597,6 +628,7 @@ struct osd_stat_t { 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; diff --git a/src/test/encoding/types.h b/src/test/encoding/types.h index e0bc0a149a8..213da6fcccc 100644 --- a/src/test/encoding/types.h +++ b/src/test/encoding/types.h @@ -35,6 +35,7 @@ TYPE(object_locator_t) TYPE(pg_t) TYPE(coll_t) TYPE(pow2_hist_t) +TYPE(filestore_perf_stat_t) TYPE(osd_stat_t) TYPE(OSDSuperblock) TYPE_FEATUREFUL(pool_snap_info_t) |