]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: track image open and lock acquire time via perf counter
authorJason Dillaman <dillaman@redhat.com>
Tue, 17 Oct 2017 19:40:55 +0000 (15:40 -0400)
committerJason Dillaman <dillaman@redhat.com>
Mon, 30 Oct 2017 15:48:34 +0000 (11:48 -0400)
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/librbd/ExclusiveLock.cc
src/librbd/ImageCtx.cc
src/librbd/Types.h

index 8436bad87695ea389c26bb3d07db3e6d5cbdb717..5821548f17b5c852016f2a5390aa1ed063097555 100644 (file)
@@ -274,6 +274,8 @@ void ExclusiveLock<I>::handle_post_acquired_lock(int r) {
   }
 
   if (r >= 0) {
+    m_image_ctx.perfcounter->tset(l_librbd_lock_acquired_time,
+                                  ceph_clock_now());
     m_image_ctx.image_watcher->notify_acquired_lock();
     m_image_ctx.io_work_queue->set_require_lock(io::DIRECTION_BOTH, false);
     m_image_ctx.io_work_queue->unblock_writes();
index 2f18856859a44f89fcec147d5874e52ff1ab6d7f..a6a57e0317140c6963a2612c3b9d4948861bed67 100644 (file)
@@ -407,8 +407,15 @@ struct C_InvalidateCache : public Context {
     plb.add_u64_counter(l_librbd_readahead_bytes, "readahead_bytes", "Data size in read ahead");
     plb.add_u64_counter(l_librbd_invalidate_cache, "invalidate_cache", "Cache invalidates");
 
+    plb.add_time(l_librbd_opened_time, "opened_time", "Opened time",
+                 "ots", perf_prio);
+    plb.add_time(l_librbd_lock_acquired_time, "lock_acquired_time",
+                 "Lock acquired time", "lats", perf_prio);
+
     perfcounter = plb.create_perf_counters();
     cct->get_perfcounters_collection()->add(perfcounter);
+
+    perfcounter->tset(l_librbd_opened_time, ceph_clock_now());
   }
 
   void ImageCtx::perf_stop() {
index 9cc16b7987731bad3e5e9e427059edbd0910199c..83f1e5689ba994e969ec771307a6bb0eb82468ca 100644 (file)
@@ -47,6 +47,9 @@ enum {
 
   l_librbd_invalidate_cache,
 
+  l_librbd_opened_time,
+  l_librbd_lock_acquired_time,
+
   l_librbd_last,
 };