]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
exporter: mark BlockTimer::get_ms() const
authorKefu Chai <tchaikov@gmail.com>
Tue, 13 Feb 2024 06:19:07 +0000 (14:19 +0800)
committerKefu Chai <tchaikov@gmail.com>
Tue, 13 Feb 2024 06:44:08 +0000 (14:44 +0800)
this function does not mutate the state of `BlockTimer`, so mark
it with `const` specifier, for better readability.

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
src/exporter/util.cc
src/exporter/util.h

index 06a8338b8a503837cef6490d84203a2a4df94ca3..9b5108390cb8a6f6826bf7e0ad3a00181f5c41e7 100644 (file)
@@ -22,7 +22,7 @@ BlockTimer::~BlockTimer() {
 }
 
 // useful with stop
-double BlockTimer::get_ms() {
+double BlockTimer::get_ms() const {
        return ms.count();
 }
 
index 2628864d515841788e2c61cc4e090e19ce626116..243568b14d21d61beb6a9108306dec84140892b5 100644 (file)
@@ -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<double, std::milli> ms;
        std::string file, function;