diff --git a/db/db_impl/db_impl_write.cc b/db/db_impl/db_impl_write.cc index a39ac014559..3893b28bd15 100644 --- a/db/db_impl/db_impl_write.cc +++ b/db/db_impl/db_impl_write.cc @@ -1147,6 +1147,7 @@ Status DBImpl::WriteToWAL(const WriteThread::WriteGroup& write_group, // Same holds for all in the batch group size_t write_with_wal = 0; WriteBatch* to_be_cached_state = nullptr; + StopWatch write_sw(env_, stats_, DB_WRITE_WAL_TIME); WriteBatch* merged_batch = MergeBatch(write_group, &tmp_batch_, &write_with_wal, &to_be_cached_state); if (merged_batch == write_group.leader->batches[0]) { @@ -1217,6 +1218,7 @@ Status DBImpl::ConcurrentWriteToWAL(const WriteThread::WriteGroup& write_group, WriteBatch tmp_batch; size_t write_with_wal = 0; WriteBatch* to_be_cached_state = nullptr; + StopWatch write_sw(env_, stats_, DB_WRITE_WAL_TIME); WriteBatch* merged_batch = MergeBatch(write_group, &tmp_batch, &write_with_wal, &to_be_cached_state); diff --git a/include/rocksdb/statistics.h b/include/rocksdb/statistics.h index 34893111933..7e3cc36fe6c 100644 --- a/include/rocksdb/statistics.h +++ b/include/rocksdb/statistics.h @@ -427,6 +427,7 @@ enum Histograms : uint32_t { // Time spent flushing memtable to disk FLUSH_TIME, SST_BATCH_SIZE, + DB_WRITE_WAL_TIME, HISTOGRAM_ENUM_MAX, }; diff --git a/monitoring/statistics.cc b/monitoring/statistics.cc index f7b117b6f88..b36609e27d8 100644 --- a/monitoring/statistics.cc +++ b/monitoring/statistics.cc @@ -225,6 +225,7 @@ const std::vector> HistogramsNameMap = { {BLOB_DB_DECOMPRESSION_MICROS, "rocksdb.blobdb.decompression.micros"}, {FLUSH_TIME, "rocksdb.db.flush.micros"}, {SST_BATCH_SIZE, "rocksdb.sst.batch.size"}, + {DB_WRITE_WAL_TIME, "rocksdb.db.write.wal.time"}, }; } // namespace rocksdb