From: Kefu Chai Date: Tue, 13 Feb 2024 06:19:07 +0000 (+0800) Subject: exporter: mark BlockTimer::get_ms() const X-Git-Tag: v20.0.0~2480^2~6 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=218f3632ca951b2524c7945ac37975b27b1c01f7;p=ceph.git exporter: mark BlockTimer::get_ms() const this function does not mutate the state of `BlockTimer`, so mark it with `const` specifier, for better readability. Signed-off-by: Kefu Chai --- diff --git a/src/exporter/util.cc b/src/exporter/util.cc index 06a8338b8a50..9b5108390cb8 100644 --- a/src/exporter/util.cc +++ b/src/exporter/util.cc @@ -22,7 +22,7 @@ BlockTimer::~BlockTimer() { } // useful with stop -double BlockTimer::get_ms() { +double BlockTimer::get_ms() const { return ms.count(); } diff --git a/src/exporter/util.h b/src/exporter/util.h index 2628864d5158..243568b14d21 100644 --- a/src/exporter/util.h +++ b/src/exporter/util.h @@ -9,7 +9,7 @@ class BlockTimer { BlockTimer(std::string file, std::string function); ~BlockTimer(); void stop(); - double get_ms(); + double get_ms() const; private: std::chrono::duration ms; std::string file, function;