]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: new osd_peer_stat_t shell type
authorSage Weil <sage@newdream.net>
Mon, 13 Feb 2012 17:42:37 +0000 (09:42 -0800)
committerSage Weil <sage@newdream.net>
Mon, 13 Feb 2012 17:42:37 +0000 (09:42 -0800)
We weren't using this, and it had broken (raw) encoding.  The constructor
also didn't initialize fields properly.

Clear out the struct and use the new encoding scheme, so we can cleanly
add fields moving forward.

Signed-off-by: Sage Weil <sage@newdream.net>
src/osd/osd_types.cc
src/osd/osd_types.h

index 5b4a10de4b8477359d39d9d7f8609d9c66885304..a54910007eaa25f380892da19c55b65903ec09d8 100644 (file)
@@ -1638,6 +1638,41 @@ void pg_create_t::generate_test_instances(list<pg_create_t*>& o)
   o.push_back(new pg_create_t(1, pg_t(3, 4, -1), 2));
 }
 
+
+// -- osd_peer_stat_t --
+
+void osd_peer_stat_t::encode(bufferlist& bl) const
+{
+  ENCODE_START(1, 1, bl);
+  ::encode(stamp, bl);
+  ENCODE_FINISH(bl);
+}
+
+void osd_peer_stat_t::decode(bufferlist::iterator& bl)
+{
+  DECODE_START(1, bl);
+  ::decode(stamp, bl);
+  DECODE_FINISH(bl);
+}
+
+void osd_peer_stat_t::dump(Formatter *f) const
+{
+  f->dump_stream("stamp") << stamp;
+}
+
+void osd_peer_stat_t::generate_test_instances(list<osd_peer_stat_t*>& o)
+{
+  o.push_back(new osd_peer_stat_t);
+  o.push_back(new osd_peer_stat_t);
+  o.back()->stamp = utime_t(1, 2);
+}
+
+ostream& operator<<(ostream& out, const osd_peer_stat_t &stat)
+{
+  return out << "stat(" << stat.stamp << ")";
+}
+
+
 // -- OSDSuperblock --
 
 void OSDSuperblock::encode(bufferlist &bl) const
index 0873664271e9c6f2aecfc2fd315a83d24c7eecc8..165e9d452f27bb9f9c669ad85b38df946cf68416 100644 (file)
@@ -1402,29 +1402,18 @@ WRITE_CLASS_ENCODER(pg_create_t)
 // -----------------------------------------
 
 struct osd_peer_stat_t {
-  struct ceph_timespec stamp;
-  float oprate;
-  float qlen;            // current
-  float recent_qlen;     // moving average
-  float read_latency;
-  float read_latency_mine;
-  float frac_rd_ops_shed_in;
-  float frac_rd_ops_shed_out;
-} __attribute__ ((packed));
-
-WRITE_RAW_ENCODER(osd_peer_stat_t)
-
-inline ostream& operator<<(ostream& out, const osd_peer_stat_t &stat) {
-  return out << "stat(" << stat.stamp
-            << " oprate=" << stat.oprate
-            << " qlen=" << stat.qlen 
-            << " recent_qlen=" << stat.recent_qlen
-            << " rdlat=" << stat.read_latency_mine << " / " << stat.read_latency
-            << " fshedin=" << stat.frac_rd_ops_shed_in
-            << ")";
-}
+  utime_t stamp;
 
+  osd_peer_stat_t() { }
+
+  void encode(bufferlist &bl) const;
+  void decode(bufferlist::iterator &bl);
+  void dump(Formatter *f) const;
+  static void generate_test_instances(list<osd_peer_stat_t*>& o);
+};
+WRITE_CLASS_ENCODER(osd_peer_stat_t)
 
+ostream& operator<<(ostream& out, const osd_peer_stat_t &stat);
 
 
 // -----------------------------------------