From: Jason Dillaman Date: Tue, 17 Oct 2017 19:40:55 +0000 (-0400) Subject: librbd: track image open and lock acquire time via perf counter X-Git-Tag: v13.0.1~307^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8583270fd2d0930c1fccd2285378de0844b1d928;p=ceph.git librbd: track image open and lock acquire time via perf counter Signed-off-by: Jason Dillaman --- diff --git a/src/librbd/ExclusiveLock.cc b/src/librbd/ExclusiveLock.cc index 8436bad8769..5821548f17b 100644 --- a/src/librbd/ExclusiveLock.cc +++ b/src/librbd/ExclusiveLock.cc @@ -274,6 +274,8 @@ void ExclusiveLock::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(); diff --git a/src/librbd/ImageCtx.cc b/src/librbd/ImageCtx.cc index 2f18856859a..a6a57e03171 100644 --- a/src/librbd/ImageCtx.cc +++ b/src/librbd/ImageCtx.cc @@ -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() { diff --git a/src/librbd/Types.h b/src/librbd/Types.h index 9cc16b79877..83f1e5689ba 100644 --- a/src/librbd/Types.h +++ b/src/librbd/Types.h @@ -47,6 +47,9 @@ enum { l_librbd_invalidate_cache, + l_librbd_opened_time, + l_librbd_lock_acquired_time, + l_librbd_last, };