|
|
@ -7,7 +7,6 @@ |
|
|
|
#define STORAGE_ROCKSDB_INCLUDE_STATISTICS_H_ |
|
|
|
#define STORAGE_ROCKSDB_INCLUDE_STATISTICS_H_ |
|
|
|
|
|
|
|
|
|
|
|
#include <atomic> |
|
|
|
#include <atomic> |
|
|
|
#include <cassert> |
|
|
|
|
|
|
|
#include <cstddef> |
|
|
|
#include <cstddef> |
|
|
|
#include <cstdint> |
|
|
|
#include <cstdint> |
|
|
|
#include <string> |
|
|
|
#include <string> |
|
|
@ -18,10 +17,8 @@ namespace rocksdb { |
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Keep adding ticker's here. |
|
|
|
* Keep adding ticker's here. |
|
|
|
* Any ticker should have a value less than TICKER_ENUM_MAX. |
|
|
|
* 1. Any ticker should be added before TICKER_ENUM_MAX. |
|
|
|
* Add a new ticker by assigning it the current value of TICKER_ENUM_MAX |
|
|
|
* 2. Add a readable string in TickersNameMap below for the newly added ticker. |
|
|
|
* Add a string representation in TickersNameMap below. |
|
|
|
|
|
|
|
* And incrementing TICKER_ENUM_MAX. |
|
|
|
|
|
|
|
*/ |
|
|
|
*/ |
|
|
|
enum Tickers { |
|
|
|
enum Tickers { |
|
|
|
// total block cache misses
|
|
|
|
// total block cache misses
|
|
|
@ -159,7 +156,7 @@ const std::vector<std::pair<Tickers, std::string>> TickersNameMap = { |
|
|
|
{ NUMBER_OF_RESEEKS_IN_ITERATION, "rocksdb.number.reseeks.iteration" }, |
|
|
|
{ NUMBER_OF_RESEEKS_IN_ITERATION, "rocksdb.number.reseeks.iteration" }, |
|
|
|
{ GET_UPDATES_SINCE_CALLS, "rocksdb.getupdatessince.calls" }, |
|
|
|
{ GET_UPDATES_SINCE_CALLS, "rocksdb.getupdatessince.calls" }, |
|
|
|
{ BLOCK_CACHE_COMPRESSED_MISS, "rocksdb.block.cachecompressed.miss" }, |
|
|
|
{ BLOCK_CACHE_COMPRESSED_MISS, "rocksdb.block.cachecompressed.miss" }, |
|
|
|
{ BLOCK_CACHE_COMPRESSED_HIT, "rocksdb.block.cachecompressed.hit" } |
|
|
|
{ BLOCK_CACHE_COMPRESSED_HIT, "rocksdb.block.cachecompressed.hit" }, |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -254,7 +251,7 @@ class Ticker { |
|
|
|
count_ = count; |
|
|
|
count_ = count; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
inline void recordTick(int count = 1) { |
|
|
|
inline void recordTick(int64_t count = 1) { |
|
|
|
count_ += count; |
|
|
|
count_ += count; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -269,13 +266,12 @@ class Ticker { |
|
|
|
// Analyze the performance of a db
|
|
|
|
// Analyze the performance of a db
|
|
|
|
class Statistics { |
|
|
|
class Statistics { |
|
|
|
public: |
|
|
|
public: |
|
|
|
|
|
|
|
|
|
|
|
virtual long getTickerCount(Tickers tickerType) = 0; |
|
|
|
virtual long getTickerCount(Tickers tickerType) = 0; |
|
|
|
virtual void recordTick(Tickers tickerType, uint64_t count = 0) = 0; |
|
|
|
virtual void recordTick(Tickers tickerType, uint64_t count = 0) = 0; |
|
|
|
virtual void setTickerCount(Tickers tickerType, uint64_t count) = 0; |
|
|
|
virtual void setTickerCount(Tickers tickerType, uint64_t count) = 0; |
|
|
|
virtual void measureTime(Histograms histogramType, uint64_t time) = 0; |
|
|
|
virtual void measureTime(Histograms histogramType, uint64_t time) = 0; |
|
|
|
|
|
|
|
|
|
|
|
virtual void histogramData(Histograms type, HistogramData * const data) = 0; |
|
|
|
virtual void histogramData(Histograms type, HistogramData* const data) = 0; |
|
|
|
// String representation of the statistic object.
|
|
|
|
// String representation of the statistic object.
|
|
|
|
std::string ToString(); |
|
|
|
std::string ToString(); |
|
|
|
}; |
|
|
|
}; |
|
|
|