diff --git a/db/db_impl.cc b/db/db_impl.cc index 4e6853e3e29946ee9abdd89030cfc2bb3104124b..dfa6f8634ed29e51a05d532f0a3890073df1cc4f 100644 --- a/db/db_impl.cc +++ b/db/db_impl.cc @@ -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 diff --git a/include/leveldb/statistics.h b/include/leveldb/statistics.h index dbdfb72251ac718eed7a5b75c7facc6c45cdd7ff..8e47b538d7d228fa77567b73bb6c584ae2aa901c 100644 --- a/include/leveldb/statistics.h +++ b/include/leveldb/statistics.h @@ -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