]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: use steady clock to measure elapsed time in AioCompletion 20007/head
authorMohamad Gebai <mgebai@suse.com>
Tue, 23 Jan 2018 16:00:53 +0000 (11:00 -0500)
committerMohamad Gebai <mgebai@suse.com>
Tue, 23 Jan 2018 16:00:53 +0000 (11:00 -0500)
Signed-off-by: Mohamad Gebai <mgebai@suse.com>
src/librbd/internal.cc
src/librbd/internal.h
src/librbd/io/AioCompletion.cc
src/librbd/io/AioCompletion.h

index 2efccda9cd22d1044b7c73f5ca91e50b4d0b5623..50e8718cae03c22e5831d6ac6cbe7199d779ac4e 100644 (file)
@@ -2150,7 +2150,8 @@ bool compare_by_name(const child_info_t& c1, const child_info_t& c2)
                       int (*cb)(uint64_t, size_t, const char *, void *),
                       void *arg)
   {
-    utime_t start_time, elapsed;
+    coarse_mono_time start_time;
+    ceph::timespan elapsed;
 
     ldout(ictx->cct, 20) << "read_iterate " << ictx << " off = " << off
                         << " len = " << len << dendl;
@@ -2176,7 +2177,7 @@ bool compare_by_name(const child_info_t& c1, const child_info_t& c2)
     }
 
     RWLock::RLocker owner_locker(ictx->owner_lock);
-    start_time = ceph_clock_now();
+    start_time = coarse_mono_clock::now();
     while (left > 0) {
       uint64_t period_off = off - (off % period);
       uint64_t read_len = min(period_off + period - off, left);
@@ -2204,7 +2205,7 @@ bool compare_by_name(const child_info_t& c1, const child_info_t& c2)
       off += ret;
     }
 
-    elapsed = ceph_clock_now() - start_time;
+    elapsed = coarse_mono_clock::now() - start_time;
     ictx->perfcounter->tinc(l_librbd_rd_latency, elapsed);
     ictx->perfcounter->inc(l_librbd_rd);
     ictx->perfcounter->inc(l_librbd_rd_bytes, mylen);
index cf5389caed1718d75e7301ac49c011b9e02e1cca..d054e8dbe4f5fb1318ccd6509782d800a97624d8 100644 (file)
@@ -15,6 +15,7 @@
 #include "include/rbd_types.h"
 #include "cls/rbd/cls_rbd_types.h"
 #include "common/WorkQueue.h"
+#include "common/ceph_time.h"
 #include "librbd/Types.h"
 
 namespace librbd {
index e30a083e136596e6630ca8370c8b4cf6fec4c9a8..ef51ad36cc42d1f5e4ea3be41c92cc13024d9af7 100644 (file)
@@ -57,8 +57,7 @@ void AioCompletion::complete() {
   CephContext *cct = ictx->cct;
 
   tracepoint(librbd, aio_complete_enter, this, rval);
-  utime_t elapsed;
-  elapsed = ceph_clock_now() - start_time;
+  ceph::timespan elapsed = coarse_mono_clock::now() - start_time;
   switch (aio_type) {
   case AIO_TYPE_GENERIC:
   case AIO_TYPE_OPEN:
@@ -116,7 +115,7 @@ void AioCompletion::init_time(ImageCtx *i, aio_type_t t) {
   if (ictx == nullptr) {
     ictx = i;
     aio_type = t;
-    start_time = ceph_clock_now();
+    start_time = coarse_mono_clock::now();
   }
 }
 
index a3edb1414236ed3bc43da8ccc6f534795d6c76d0..e0b07cc6ef2879bf5807df737cee306d004fa0fd 100644 (file)
@@ -6,6 +6,7 @@
 
 #include "common/Cond.h"
 #include "common/Mutex.h"
+#include "common/ceph_time.h"
 #include "include/Context.h"
 #include "include/utime.h"
 #include "include/rbd/librbd.hpp"
@@ -53,7 +54,7 @@ struct AioCompletion {
   int ref;
   bool released;
   ImageCtx *ictx;
-  utime_t start_time;
+  coarse_mono_time start_time;
   aio_type_t aio_type;
 
   ReadResult read_result;