diff --git a/db/db_test.cc b/db/db_test.cc index 4a08a99eb..f7a5072fa 100644 --- a/db/db_test.cc +++ b/db/db_test.cc @@ -4718,7 +4718,7 @@ TEST_F(DBTest, CompressionStatsTest) { Options options = CurrentOptions(); options.compression = type; options.statistics = rocksdb::CreateDBStatistics(); - options.statistics->stats_level_ = StatsLevel::kAll; + options.statistics->stats_level_ = StatsLevel::kExceptTimeForMutex; DestroyAndReopen(options); int kNumKeysWritten = 100000; diff --git a/include/rocksdb/statistics.h b/include/rocksdb/statistics.h index 6e2454ab6..7dbd707a9 100644 --- a/include/rocksdb/statistics.h +++ b/include/rocksdb/statistics.h @@ -393,12 +393,12 @@ struct HistogramData { }; enum StatsLevel { + // Collect all stats except time inside mutex lock AND time spent on + // compression. + kExceptDetailedTimers, // Collect all stats except the counters requiring to get time inside the // mutex lock. kExceptTimeForMutex, - // Collect all stats expect time inside mutex lock AND time spent on - // compression - kExceptDetailedTimers, // Collect all stats, including measuring duration of mutex operations. // If getting time is expensive on the platform to run, it can // reduce scalability to more threads, especially for writes. @@ -429,7 +429,7 @@ class Statistics { return type < HISTOGRAM_ENUM_MAX; } - StatsLevel stats_level_ = kExceptTimeForMutex; + StatsLevel stats_level_ = kExceptDetailedTimers; }; // Create a concrete DBStatistics object diff --git a/util/instrumented_mutex.cc b/util/instrumented_mutex.cc index 4eba27720..c32a86df7 100644 --- a/util/instrumented_mutex.cc +++ b/util/instrumented_mutex.cc @@ -11,7 +11,7 @@ namespace rocksdb { namespace { bool ShouldReportToStats(Env* env, Statistics* stats) { return env != nullptr && stats != nullptr && - stats->stats_level_ != kExceptTimeForMutex; + stats->stats_level_ > kExceptTimeForMutex; } } // namespace