From 02974c94375771e472505d23e9af2baab4ccec73 Mon Sep 17 00:00:00 2001 From: jsteemann Date: Mon, 8 Mar 2021 21:31:36 -0800 Subject: [PATCH] make PerfStepTimer struct smaller by reordering members (#7931) Summary: On x86_64, this makes the struct 8 bytes smaller, so creating a PerfStepTimer on the stack will use slightly less stack space. Pull Request resolved: https://github.com/facebook/rocksdb/pull/7931 Reviewed By: jay-zhuang Differential Revision: D26529470 Pulled By: ajkr fbshipit-source-id: bbe2e843167152ffa05a5946f1add6621c9849f7 --- monitoring/perf_step_timer.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/monitoring/perf_step_timer.h b/monitoring/perf_step_timer.h index e5593cebd..fb049f725 100644 --- a/monitoring/perf_step_timer.h +++ b/monitoring/perf_step_timer.h @@ -18,13 +18,13 @@ class PerfStepTimer { Statistics* statistics = nullptr, uint32_t ticker_type = 0) : perf_counter_enabled_(perf_level >= enable_level), use_cpu_time_(use_cpu_time), + ticker_type_(ticker_type), clock_((perf_counter_enabled_ || statistics != nullptr) ? (clock ? clock : SystemClock::Default().get()) : nullptr), start_(0), metric_(metric), - statistics_(statistics), - ticker_type_(ticker_type) {} + statistics_(statistics) {} ~PerfStepTimer() { Stop(); @@ -69,11 +69,11 @@ class PerfStepTimer { const bool perf_counter_enabled_; const bool use_cpu_time_; + uint32_t ticker_type_; SystemClock* const clock_; uint64_t start_; uint64_t* metric_; Statistics* statistics_; - uint32_t ticker_type_; }; } // namespace ROCKSDB_NAMESPACE