]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: dump op priority queue state via admin socket
authorSage Weil <sage@inktank.com>
Mon, 21 Jan 2013 23:59:07 +0000 (15:59 -0800)
committerSamuel Just <sam.just@inktank.com>
Sat, 26 Jan 2013 01:17:12 +0000 (17:17 -0800)
Signed-off-by: Sage Weil <sage@inktank.com>
(cherry picked from commit 24d0d7eb0165c8b8f923f2d8896b156bfb5e0e60)

src/osd/OSD.cc
src/osd/OSD.h

index d794fa8bdcd5039cae4411a7add8b94b8ec02b3e..2c22d63ac0a842cb95fba4c81afa32f7186cc11f 100644 (file)
@@ -865,6 +865,12 @@ bool OSD::asok_command(string command, string args, ostream& ss)
     op_tracker.dump_ops_in_flight(ss);
   } else if (command == "dump_historic_ops") {
     op_tracker.dump_historic_ops(ss);
+  } else if (command == "dump_op_pq_state") {
+    JSONFormatter f(true);
+    f.open_object_section("pq");
+    op_wq.dump(&f);
+    f.close_section();
+    f.flush(ss);
   } else {
     assert(0 == "broken asok registration");
   }
@@ -970,6 +976,8 @@ int OSD::init()
                                     "show the ops currently in flight");
   r = admin_socket->register_command("dump_historic_ops", asok_hook,
                                     "show slowest recent ops");
+  r = admin_socket->register_command("dump_op_pq_state", asok_hook,
+                                    "dump op priority queue state");
   assert(r == 0);
 
   service.init();
@@ -1124,6 +1132,7 @@ int OSD::shutdown()
 
   cct->get_admin_socket()->unregister_command("dump_ops_in_flight");
   cct->get_admin_socket()->unregister_command("dump_historic_ops");
+  cct->get_admin_socket()->unregister_command("dump_op_pq_state");
   delete asok_hook;
   asok_hook = NULL;
 
index 17bea46e2b8c55ff1ee46b2deb3aff5c1f554af4..766686825a90ef93e5cf383c45a5c657b3fafc11 100644 (file)
@@ -644,6 +644,11 @@ private:
               o->cct->_conf->osd_op_pq_min_cost)
     {}
 
+    void dump(Formatter *f) {
+      Mutex::Locker l(qlock);
+      pqueue.dump(f);
+    }
+
     void _enqueue_front(pair<PGRef, OpRequestRef> item);
     void _enqueue(pair<PGRef, OpRequestRef> item);
     PGRef _dequeue();