提交 ec77366e 编写于 作者: A Abhishek Kona

Counters for bytes written and read.

Summary:
* Counters for bytes read and write.
as a part of this diff, I want to=>
* Measure compaction times. @dhruba can you point which function, should
* I time to get Compaction-times. Was looking at CompactRange.

Test Plan: db_test

Reviewers: dhruba, emayanke

CC: leveldb

Differential Revision: https://reviews.facebook.net/D8763
上级 6abb30d4
......@@ -1650,7 +1650,7 @@ Status DBImpl::DoCompactionWork(CompactionState* compact) {
assert(ikey.type != kTypeDeletion);
UpdateInternalKey(key, (uint64_t)0, ikey.type);
}
// Open output file if necessary
if (compact->builder == nullptr) {
status = OpenCompactionOutputFile(compact);
......@@ -1855,6 +1855,7 @@ Status DBImpl::Get(const ReadOptions& options,
imm.UnrefAll();
current->Unref();
RecordTick(options_.statistics, NUMBER_KEYS_READ);
RecordTick(options_.statistics, BYTES_READ, value->size());
return s;
}
......@@ -1917,7 +1918,9 @@ Status DBImpl::Write(const WriteOptions& options, WriteBatch* my_batch) {
last_sequence += my_batch_count;
// Record statistics
RecordTick(options_.statistics, NUMBER_KEYS_WRITTEN, my_batch_count);
RecordTick(options_.statistics,
BYTES_WRITTEN,
WriteBatchInternal::ByteSize(updates));
// Add to log and apply to memtable. We can release the lock
// during this phase since &w is currently responsible for logging
// and protects against concurrent loggers and concurrent writes
......
......@@ -33,9 +33,13 @@ enum Tickers {
NUMBER_KEYS_WRITTEN = 6,
// Number of Keys read,
NUMBER_KEYS_READ = 7,
TICKER_ENUM_MAX = 8,
// Bytes written / read
BYTES_WRITTEN = 8,
BYTES_READ = 9,
TICKER_ENUM_MAX = 10,
};
/**
* Keep adding histogram's here.
* Any histogram whould have value less than HISTOGRAM_ENUM_MAX
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册