diff --git a/monitoring/instrumented_mutex.cc b/monitoring/instrumented_mutex.cc index 8b06c60ff855896948316b97fc4cd4212b8a6587..d82e594c1d01cec426ae308fc190398ed2ffdf4c 100644 --- a/monitoring/instrumented_mutex.cc +++ b/monitoring/instrumented_mutex.cc @@ -10,6 +10,7 @@ namespace ROCKSDB_NAMESPACE { namespace { +#ifndef NPERF_CONTEXT Statistics* stats_for_report(Env* env, Statistics* stats) { if (env != nullptr && stats != nullptr && stats->get_stats_level() > kExceptTimeForMutex) { @@ -18,6 +19,7 @@ Statistics* stats_for_report(Env* env, Statistics* stats) { return nullptr; } } +#endif // NPERF_CONTEXT } // namespace void InstrumentedMutex::Lock() { diff --git a/monitoring/perf_context.cc b/monitoring/perf_context.cc index 446a9b7663ee8d1265e6e8ab7092989a770cd65c..53f5024050abc279029bbf5340b683c8c6b79dce 100644 --- a/monitoring/perf_context.cc +++ b/monitoring/perf_context.cc @@ -38,7 +38,9 @@ PerfContext::~PerfContext() { } PerfContext::PerfContext(const PerfContext& other) { -#ifndef NPERF_CONTEXT +#ifdef NPERF_CONTEXT + (void)other; +#else user_key_comparison_count = other.user_key_comparison_count; block_cache_hit_count = other.block_cache_hit_count; block_read_count = other.block_read_count; @@ -133,7 +135,9 @@ PerfContext::PerfContext(const PerfContext& other) { } PerfContext::PerfContext(PerfContext&& other) noexcept { -#ifndef NPERF_CONTEXT +#ifdef NPERF_CONTEXT + (void)other; +#else user_key_comparison_count = other.user_key_comparison_count; block_cache_hit_count = other.block_cache_hit_count; block_read_count = other.block_read_count; @@ -230,7 +234,9 @@ PerfContext::PerfContext(PerfContext&& other) noexcept { // TODO(Zhongyi): reduce code duplication between copy constructor and // assignment operator PerfContext& PerfContext::operator=(const PerfContext& other) { -#ifndef NPERF_CONTEXT +#ifdef NPERF_CONTEXT + (void)other; +#else user_key_comparison_count = other.user_key_comparison_count; block_cache_hit_count = other.block_cache_hit_count; block_read_count = other.block_read_count; @@ -443,6 +449,7 @@ void PerfContextByLevel::Reset() { std::string PerfContext::ToString(bool exclude_zero_counters) const { #ifdef NPERF_CONTEXT + (void)exclude_zero_counters; return ""; #else std::ostringstream ss;