From 92574ab8f61c87215ab9651e7772dba225e2d873 Mon Sep 17 00:00:00 2001 From: Henry Chang Date: Thu, 23 Apr 2015 10:38:27 +0800 Subject: [PATCH] Throttle: reset max only if max changed Save some CPU cycles. Signed-off-by: Henry Chang --- src/common/Throttle.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/common/Throttle.cc b/src/common/Throttle.cc index f0dd91d4db9e..ce7666904e17 100644 --- a/src/common/Throttle.cc +++ b/src/common/Throttle.cc @@ -80,6 +80,8 @@ Throttle::~Throttle() void Throttle::_reset_max(int64_t m) { assert(lock.is_locked()); + if ((int64_t)max.read() == m) + return; if (!cond.empty()) cond.front()->SignalOne(); if (logger) -- 2.47.3