diff --git a/include/rocksdb/statistics.h b/include/rocksdb/statistics.h index 3fa8959ca..238b2c71b 100644 --- a/include/rocksdb/statistics.h +++ b/include/rocksdb/statistics.h @@ -39,6 +39,8 @@ enum Tickers : uint32_t { BLOCK_CACHE_INDEX_MISS, // # of times cache hit when accessing index block from block cache. BLOCK_CACHE_INDEX_HIT, + // # of index blocks added to block cache. + BLOCK_CACHE_INDEX_ADD, // # of bytes of index blocks inserted into cache BLOCK_CACHE_INDEX_BYTES_INSERT, // # of bytes of index block erased from cache @@ -47,6 +49,8 @@ enum Tickers : uint32_t { BLOCK_CACHE_FILTER_MISS, // # of times cache hit when accessing filter block from block cache. BLOCK_CACHE_FILTER_HIT, + // # of filter blocks added to block cache. + BLOCK_CACHE_FILTER_ADD, // # of bytes of bloom filter blocks inserted into cache BLOCK_CACHE_FILTER_BYTES_INSERT, // # of bytes of bloom filter block erased from cache @@ -55,6 +59,10 @@ enum Tickers : uint32_t { BLOCK_CACHE_DATA_MISS, // # of times cache hit when accessing data block from block cache. BLOCK_CACHE_DATA_HIT, + // # of data blocks added to block cache. + BLOCK_CACHE_DATA_ADD, + // # of bytes of data blocks inserted into cache + BLOCK_CACHE_DATA_BYTES_INSERT, // # of bytes read from cache. BLOCK_CACHE_BYTES_READ, // # of bytes written into cache. @@ -217,15 +225,19 @@ const std::vector> TickersNameMap = { {BLOCK_CACHE_ADD_FAILURES, "rocksdb.block.cache.add.failures"}, {BLOCK_CACHE_INDEX_MISS, "rocksdb.block.cache.index.miss"}, {BLOCK_CACHE_INDEX_HIT, "rocksdb.block.cache.index.hit"}, + {BLOCK_CACHE_INDEX_ADD, "rocksdb.block.cache.index.add"}, {BLOCK_CACHE_INDEX_BYTES_INSERT, "rocksdb.block.cache.index.bytes.insert"}, {BLOCK_CACHE_INDEX_BYTES_EVICT, "rocksdb.block.cache.index.bytes.evict"}, {BLOCK_CACHE_FILTER_MISS, "rocksdb.block.cache.filter.miss"}, {BLOCK_CACHE_FILTER_HIT, "rocksdb.block.cache.filter.hit"}, + {BLOCK_CACHE_FILTER_ADD, "rocksdb.block.cache.filter.add"}, {BLOCK_CACHE_FILTER_BYTES_INSERT, "rocksdb.block.cache.filter.bytes.insert"}, {BLOCK_CACHE_FILTER_BYTES_EVICT, "rocksdb.block.cache.filter.bytes.evict"}, {BLOCK_CACHE_DATA_MISS, "rocksdb.block.cache.data.miss"}, {BLOCK_CACHE_DATA_HIT, "rocksdb.block.cache.data.hit"}, + {BLOCK_CACHE_DATA_ADD, "rocksdb.block.cache.data.add"}, + {BLOCK_CACHE_DATA_BYTES_INSERT, "rocksdb.block.cache.data.bytes.insert"}, {BLOCK_CACHE_BYTES_READ, "rocksdb.block.cache.bytes.read"}, {BLOCK_CACHE_BYTES_WRITE, "rocksdb.block.cache.bytes.write"}, {BLOOM_FILTER_USEFUL, "rocksdb.bloom.filter.useful"}, diff --git a/table/block_based_table_reader.cc b/table/block_based_table_reader.cc index ef31c7012..ae6cb795d 100644 --- a/table/block_based_table_reader.cc +++ b/table/block_based_table_reader.cc @@ -877,6 +877,11 @@ Status BlockBasedTable::GetDataBlockFromCache( &DeleteCachedEntry, &(block->cache_handle)); if (s.ok()) { RecordTick(statistics, BLOCK_CACHE_ADD); + RecordTick(statistics, BLOCK_CACHE_DATA_ADD); + RecordTick(statistics, BLOCK_CACHE_DATA_BYTES_INSERT, + block->value->usable_size()); + RecordTick(statistics, BLOCK_CACHE_BYTES_WRITE, + block->value->usable_size()); } else { RecordTick(statistics, BLOCK_CACHE_ADD_FAILURES); delete block->value; @@ -946,6 +951,9 @@ Status BlockBasedTable::PutDataBlockToCache( if (s.ok()) { assert(block->cache_handle != nullptr); RecordTick(statistics, BLOCK_CACHE_ADD); + RecordTick(statistics, BLOCK_CACHE_DATA_ADD); + RecordTick(statistics, BLOCK_CACHE_DATA_BYTES_INSERT, + block->value->usable_size()); RecordTick(statistics, BLOCK_CACHE_BYTES_WRITE, block->value->usable_size()); assert(reinterpret_cast( @@ -1052,8 +1060,9 @@ BlockBasedTable::CachableEntry BlockBasedTable::GetFilter( : Cache::Priority::LOW); if (s.ok()) { RecordTick(statistics, BLOCK_CACHE_ADD); - RecordTick(statistics, BLOCK_CACHE_BYTES_WRITE, filter->size()); + RecordTick(statistics, BLOCK_CACHE_FILTER_ADD); RecordTick(statistics, BLOCK_CACHE_FILTER_BYTES_INSERT, filter->size()); + RecordTick(statistics, BLOCK_CACHE_BYTES_WRITE, filter->size()); } else { RecordTick(statistics, BLOCK_CACHE_ADD_FAILURES); delete filter; @@ -1126,8 +1135,9 @@ InternalIterator* BlockBasedTable::NewIndexIterator( if (s.ok()) { size_t usable_size = index_reader->usable_size(); RecordTick(statistics, BLOCK_CACHE_ADD); - RecordTick(statistics, BLOCK_CACHE_BYTES_WRITE, usable_size); + RecordTick(statistics, BLOCK_CACHE_INDEX_ADD); RecordTick(statistics, BLOCK_CACHE_INDEX_BYTES_INSERT, usable_size); + RecordTick(statistics, BLOCK_CACHE_BYTES_WRITE, usable_size); } else { if (index_reader != nullptr) { delete index_reader;