[Rocksdb] Record WriteBlock Times into a histogram

Summary: Add a histogram to track WriteBlock times

Test Plan: db_bench and print

Reviewers: haobo, dhruba

Reviewed By: haobo

CC: leveldb

Differential Revision: https://reviews.facebook.net/D11319
main
Abhishek Kona 12 years ago
parent 8926b72751
commit 39ee47fbf4
  1. 6
      include/leveldb/statistics.h
  2. 2
      table/table_builder.cc

@ -105,7 +105,8 @@ enum Histograms {
DB_MULTIGET = 8, DB_MULTIGET = 8,
READ_BLOCK_COMPACTION_MICROS = 9, READ_BLOCK_COMPACTION_MICROS = 9,
READ_BLOCK_GET_MICROS = 10, READ_BLOCK_GET_MICROS = 10,
HISTOGRAM_ENUM_MAX = 11 WRITE_RAW_BLOCK_MICROS = 11,
HISTOGRAM_ENUM_MAX = 12
}; };
const std::vector<std::pair<Histograms, std::string>> HistogramsNameMap = { const std::vector<std::pair<Histograms, std::string>> HistogramsNameMap = {
@ -120,7 +121,8 @@ const std::vector<std::pair<Histograms, std::string>> HistogramsNameMap = {
std::make_pair(TABLE_OPEN_IO_MICROS, "rocksdb.table.open.io.micros"), std::make_pair(TABLE_OPEN_IO_MICROS, "rocksdb.table.open.io.micros"),
std::make_pair(DB_MULTIGET, "rocksdb.db.multiget.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_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 { struct HistogramData {

@ -14,6 +14,7 @@
#include "table/format.h" #include "table/format.h"
#include "util/coding.h" #include "util/coding.h"
#include "util/crc32c.h" #include "util/crc32c.h"
#include "util/stop_watch.h"
namespace leveldb { namespace leveldb {
@ -231,6 +232,7 @@ void TableBuilder::WriteRawBlock(const Slice& block_contents,
CompressionType type, CompressionType type,
BlockHandle* handle) { BlockHandle* handle) {
Rep* r = rep_; Rep* r = rep_;
StopWatch sw(r->options.env, r->options.statistics, WRITE_RAW_BLOCK_MICROS);
handle->set_offset(r->offset); handle->set_offset(r->offset);
handle->set_size(block_contents.size()); handle->set_size(block_contents.size());
r->status = r->file->Append(block_contents); r->status = r->file->Append(block_contents);

Loading…
Cancel
Save