]> git.apps.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)
committerSage Weil <sage@inktank.com>
Tue, 22 Jan 2013 22:47:42 +0000 (14:47 -0800)
Signed-off-by: Sage Weil <sage@inktank.com>
src/osd/OSD.cc
src/osd/OSD.h

index 67bc52b114b473fd2c38bcdc5053bd05ed5906fe..b28cace35b47fb7c2583694d0858bf3df925b144 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 4b9e0e0b192af1d9e8b66abbb73584549bf104f0..c9b408a2747c5c5dad3bfe69981484927d612c91 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();