diff --git a/logging/env_logger.h b/logging/env_logger.h index b9099a834..8164945cf 100644 --- a/logging/env_logger.h +++ b/logging/env_logger.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_); } diff --git a/monitoring/iostats_context_imp.h b/monitoring/iostats_context_imp.h index 42b8a82fc..a0b4292df 100644 --- a/monitoring/iostats_context_imp.h +++ b/monitoring/iostats_context_imp.h @@ -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(clock)