Skip to content

Commit

Permalink
bluestore: tiny tracepoints improvement
Browse files Browse the repository at this point in the history
    Fixed reversed (-) latency, synchronized all 'elapsed' times to seconds, transitioned to mono_clock.

Signed-off-by: Adam Kupczyk <[email protected]>
  • Loading branch information
aclamk committed Nov 27, 2019
1 parent 8ece362 commit d4f2f81
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
24 changes: 12 additions & 12 deletions src/os/bluestore/BlueStore.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<double>(lat) >= cct->_conf->bluestore_log_op_age) {
dout(0) << __func__ << " slow aio_wait, txc = " << txc
<< ", latency = " << lat
<< dendl;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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<double>(sync_start - mono_clock::now());
double sync_latency = ceph::to_seconds<double>(mono_clock::now() - sync_start);
for (auto txc: kv_committing) {
if (txc->tracing) {
tracepoint(
Expand Down Expand Up @@ -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 &&
Expand All @@ -14894,7 +14894,7 @@ utime_t BlueStore::BlueStoreThrottle::log_state_latency(
txc.osr->get_sequencer_id(),
txc.seq,
state,
(double)lat);
ceph::to_seconds<double>(lat));
}
#endif
txc.last_stamp = now;
Expand Down Expand Up @@ -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<double>(mono_clock::now() - txc.start));
}
}
#endif
Expand All @@ -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<double>(lat));
}
}
#endif
Expand Down
8 changes: 4 additions & 4 deletions src/os/bluestore/BlueStore.h
Original file line number Diff line number Diff line change
Expand Up @@ -1542,8 +1542,8 @@ class BlueStore : public ObjectStore,
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
Expand All @@ -1557,7 +1557,7 @@ class BlueStore : public ObjectStore,
: 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);
Expand Down Expand Up @@ -1669,7 +1669,7 @@ class BlueStore : public ObjectStore,
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,
Expand Down

0 comments on commit d4f2f81

Please sign in to comment.