From d4f2f8182236d18a14620b08ead6165a49906b7a Mon Sep 17 00:00:00 2001 From: Adam Kupczyk Date: Fri, 15 Nov 2019 06:23:03 -0500 Subject: [PATCH] bluestore: tiny tracepoints improvement Fixed reversed (-) latency, synchronized all 'elapsed' times to seconds, transitioned to mono_clock. Signed-off-by: Adam Kupczyk --- src/os/bluestore/BlueStore.cc | 24 ++++++++++++------------ src/os/bluestore/BlueStore.h | 8 ++++---- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index c2b77bb47cf..ac81890f638 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -10956,9 +10956,9 @@ void BlueStore::_txc_state_proc(TransContext *txc) case TransContext::STATE_AIO_WAIT: { - utime_t lat = throttle.log_state_latency( + mono_clock::duration lat = throttle.log_state_latency( *txc, logger, l_bluestore_state_aio_wait_lat); - if (lat >= cct->_conf->bluestore_log_op_age) { + if (ceph::to_seconds(lat) >= cct->_conf->bluestore_log_op_age) { dout(0) << __func__ << " slow aio_wait, txc = " << txc << ", latency = " << lat << dendl; @@ -11244,7 +11244,7 @@ void BlueStore::_txc_committed_kv(TransContext *txc) log_latency_fn( __func__, l_bluestore_commit_lat, - ceph::make_timespan(ceph_clock_now() - txc->start), + mono_clock::now() - txc->start, cct->_conf->bluestore_log_op_age, [&](auto lat) { return ", txc = " + stringify(txc); @@ -11724,7 +11724,7 @@ void BlueStore::_kv_sync_thread() int deferred_size = deferred_stable.size(); #if defined(WITH_LTTNG) - double sync_latency = ceph::to_seconds(sync_start - mono_clock::now()); + double sync_latency = ceph::to_seconds(mono_clock::now() - sync_start); for (auto txc: kv_committing) { if (txc->tracing) { tracepoint( @@ -14877,11 +14877,11 @@ void BlueStore::BlueStoreThrottle::emit_initial_tracepoint( } #endif -utime_t BlueStore::BlueStoreThrottle::log_state_latency( +mono_clock::duration BlueStore::BlueStoreThrottle::log_state_latency( TransContext &txc, PerfCounters *logger, int state) { - utime_t now = ceph_clock_now(); - utime_t lat = now - txc.last_stamp; + mono_clock::time_point now = mono_clock::now(); + mono_clock::duration lat = now - txc.last_stamp; logger->tinc(state, lat); #if defined(WITH_LTTNG) if (txc.tracing && @@ -14894,7 +14894,7 @@ utime_t BlueStore::BlueStoreThrottle::log_state_latency( txc.osr->get_sequencer_id(), txc.seq, state, - (double)lat); + ceph::to_seconds(lat)); } #endif txc.last_stamp = now; @@ -14937,7 +14937,7 @@ void BlueStore::BlueStoreThrottle::complete_kv(TransContext &txc) transaction_commit_latency, txc.osr->get_sequencer_id(), txc.seq, - ((double)ceph_clock_now()) - ((double)txc.start)); + ceph::to_seconds(mono_clock::now() - txc.start)); } } #endif @@ -14949,14 +14949,14 @@ void BlueStore::BlueStoreThrottle::complete(TransContext &txc) pending_deferred_ios -= 1; } if (txc.tracing) { - utime_t now = ceph_clock_now(); - double usecs = ((double)(now.to_nsec()-txc.start.to_nsec()))/1000; + mono_clock::time_point now = mono_clock::now(); + mono_clock::duration lat = now - txc.start; tracepoint( bluestore, transaction_total_duration, txc.osr->get_sequencer_id(), txc.seq, - usecs); + ceph::to_seconds(lat)); } } #endif diff --git a/src/os/bluestore/BlueStore.h b/src/os/bluestore/BlueStore.h index 9baeca02188..a2875de18cf 100644 --- a/src/os/bluestore/BlueStore.h +++ b/src/os/bluestore/BlueStore.h @@ -1542,8 +1542,8 @@ public: bool had_ios = false; ///< true if we submitted IOs before our kv txn uint64_t seq = 0; - utime_t start; - utime_t last_stamp; + mono_clock::time_point start; + mono_clock::time_point last_stamp; uint64_t last_nid = 0; ///< if non-zero, highest new nid we allocated uint64_t last_blobid = 0; ///< if non-zero, highest new blobid we allocated @@ -1557,7 +1557,7 @@ public: : ch(c), osr(o), ioc(cct, this), - start(ceph_clock_now()) { + start(mono_clock::now()) { last_stamp = start; if (on_commits) { oncommits.swap(*on_commits); @@ -1669,7 +1669,7 @@ public: void complete(TransContext &txc) {} #endif - utime_t log_state_latency( + mono_clock::duration log_state_latency( TransContext &txc, PerfCounters *logger, int state); bool try_start_transaction( KeyValueDB &db, -- 2.39.5