diff --git a/include/leveldb/statistics.h b/include/leveldb/statistics.h index 9fa5352ce..7dd414fce 100644 --- a/include/leveldb/statistics.h +++ b/include/leveldb/statistics.h @@ -105,7 +105,8 @@ enum Histograms { DB_MULTIGET = 8, READ_BLOCK_COMPACTION_MICROS = 9, READ_BLOCK_GET_MICROS = 10, - HISTOGRAM_ENUM_MAX = 11 + WRITE_RAW_BLOCK_MICROS = 11, + HISTOGRAM_ENUM_MAX = 12 }; const std::vector> HistogramsNameMap = { @@ -120,7 +121,8 @@ const std::vector> HistogramsNameMap = { std::make_pair(TABLE_OPEN_IO_MICROS, "rocksdb.table.open.io.micros"), std::make_pair(DB_MULTIGET, "rocksdb.db.multiget.micros"), std::make_pair(READ_BLOCK_COMPACTION_MICROS, "rocksdb.read.block.compaction.micros"), - std::make_pair(READ_BLOCK_GET_MICROS, "rocksdb.read.block.get.micros") + std::make_pair(READ_BLOCK_GET_MICROS, "rocksdb.read.block.get.micros"), + std::make_pair(WRITE_RAW_BLOCK_MICROS, "rocksdb.write.raw.block.micros") }; struct HistogramData { diff --git a/table/table_builder.cc b/table/table_builder.cc index 8b81d2374..078ffedf2 100644 --- a/table/table_builder.cc +++ b/table/table_builder.cc @@ -14,6 +14,7 @@ #include "table/format.h" #include "util/coding.h" #include "util/crc32c.h" +#include "util/stop_watch.h" namespace leveldb { @@ -231,6 +232,7 @@ void TableBuilder::WriteRawBlock(const Slice& block_contents, CompressionType type, BlockHandle* handle) { Rep* r = rep_; + StopWatch sw(r->options.env, r->options.statistics, WRITE_RAW_BLOCK_MICROS); handle->set_offset(r->offset); handle->set_size(block_contents.size()); r->status = r->file->Append(block_contents);