Fix build error with NIOSTATS_CONTEXT (#10506)

Summary:
Fix https://github.com/facebook/rocksdb/issues/10475

Pull Request resolved: https://github.com/facebook/rocksdb/pull/10506

Reviewed By: hx235

Differential Revision: D38549337

Pulled By: ajkr

fbshipit-source-id: fba864fba1b584c41419ca6015d5d62051539812
main
lhsoft 2 years ago committed by Facebook GitHub Bot
parent 6e93d24935
commit 38bf569ee7
  1. 4
      logging/env_logger.h
  2. 3
      monitoring/iostats_context_imp.h

@ -57,12 +57,12 @@ class EnvLogger : public Logger {
// Preserve iostats not to pollute writes from user writes. We might
// need a better solution than this.
SetPerfLevel(PerfLevel::kDisable);
iostats_context.disable_iostats = true;
IOSTATS_SET_DISABLE(true);
logger.mutex_.Lock();
}
~FileOpGuard() {
logger_.mutex_.Unlock();
iostats_context.disable_iostats = false;
IOSTATS_SET_DISABLE(false);
SetPerfLevel(prev_perf_level_);
}

@ -43,6 +43,8 @@ extern thread_local IOStatsContext iostats_context;
PerfLevel::kEnableTimeAndCPUTimeExceptForMutex); \
iostats_step_timer_##metric.Start();
#define IOSTATS_SET_DISABLE(disable) (iostats_context.disable_iostats = disable)
#else // !NIOSTATS_CONTEXT
#define IOSTATS_ADD(metric, value)
@ -52,6 +54,7 @@ extern thread_local IOStatsContext iostats_context;
#define IOSTATS_SET_THREAD_POOL_ID(value)
#define IOSTATS_THREAD_POOL_ID()
#define IOSTATS(metric) 0
#define IOSTATS_SET_DISABLE(disable)
#define IOSTATS_TIMER_GUARD(metric)
#define IOSTATS_CPU_TIMER_GUARD(metric, clock) static_cast<void>(clock)

Loading…
Cancel
Save