提交 e60ea7fe 编写于 作者: A Andrew Kryczka 提交者: Facebook GitHub Bot

fix compiler errors with -DNPERF_CONTEXT (#6642)

Summary:
as titled
Pull Request resolved: https://github.com/facebook/rocksdb/pull/6642

Test Plan:
```
$ EXTRA_CXXFLAGS="-DNPERF_CONTEXT" DEBUG_LEVEL=0 make -j48 db_bench
```

Reviewed By: riversand963

Differential Revision: D20842313

Pulled By: ajkr

fbshipit-source-id: a830cad312ca681591f06749242279503b101df2
上级 259b6ec8
......@@ -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() {
......
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册