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
This commit is contained in:
jsteemann 2021-03-08 21:31:36 -08:00 committed by Facebook GitHub Bot
parent ef392fb04e
commit 02974c9437

View File

@ -18,13 +18,13 @@ class PerfStepTimer {
Statistics* statistics = nullptr, uint32_t ticker_type = 0) Statistics* statistics = nullptr, uint32_t ticker_type = 0)
: perf_counter_enabled_(perf_level >= enable_level), : perf_counter_enabled_(perf_level >= enable_level),
use_cpu_time_(use_cpu_time), use_cpu_time_(use_cpu_time),
ticker_type_(ticker_type),
clock_((perf_counter_enabled_ || statistics != nullptr) clock_((perf_counter_enabled_ || statistics != nullptr)
? (clock ? clock : SystemClock::Default().get()) ? (clock ? clock : SystemClock::Default().get())
: nullptr), : nullptr),
start_(0), start_(0),
metric_(metric), metric_(metric),
statistics_(statistics), statistics_(statistics) {}
ticker_type_(ticker_type) {}
~PerfStepTimer() { ~PerfStepTimer() {
Stop(); Stop();
@ -69,11 +69,11 @@ class PerfStepTimer {
const bool perf_counter_enabled_; const bool perf_counter_enabled_;
const bool use_cpu_time_; const bool use_cpu_time_;
uint32_t ticker_type_;
SystemClock* const clock_; SystemClock* const clock_;
uint64_t start_; uint64_t start_;
uint64_t* metric_; uint64_t* metric_;
Statistics* statistics_; Statistics* statistics_;
uint32_t ticker_type_;
}; };
} // namespace ROCKSDB_NAMESPACE } // namespace ROCKSDB_NAMESPACE