From 1d99222ffce05265e13d9db69411d60de98378d9 Mon Sep 17 00:00:00 2001 From: Joshua Baergen Date: Mon, 24 Jul 2023 10:36:21 -0600 Subject: [PATCH] TrackedOp: Make history_slow_op_threshold a float It's already the case that osd_op_history_slow_op_threshold as well as the computed op duration are floating-point, but we were losing this precision within OpHistory. Fixes: https://tracker.ceph.com/issues/62169 Signed-off-by: Joshua Baergen --- src/common/TrackedOp.cc | 2 +- src/common/TrackedOp.h | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/common/TrackedOp.cc b/src/common/TrackedOp.cc index d63bdb8f9a574..1a3186b9fa002 100644 --- a/src/common/TrackedOp.cc +++ b/src/common/TrackedOp.cc @@ -204,7 +204,7 @@ void OpHistory::dump_slow_ops(utime_t now, Formatter *f, set filters) cleanup(now); f->open_object_section("OpHistory slow ops"); f->dump_int("num to keep", history_slow_op_size.load()); - f->dump_int("threshold to keep", history_slow_op_threshold.load()); + f->dump_float("threshold to keep", history_slow_op_threshold.load()); { f->open_array_section("Ops"); for (set >::const_iterator i = diff --git a/src/common/TrackedOp.h b/src/common/TrackedOp.h index 31afba1853e3a..167375dc44deb 100644 --- a/src/common/TrackedOp.h +++ b/src/common/TrackedOp.h @@ -67,7 +67,7 @@ class OpHistory { std::atomic_size_t history_size{0}; std::atomic_uint32_t history_duration{0}; std::atomic_size_t history_slow_op_size{0}; - std::atomic_uint32_t history_slow_op_threshold{0}; + std::atomic history_slow_op_threshold{0}; std::atomic_bool shutdown{false}; OpHistoryServiceThread opsvc; friend class OpHistoryServiceThread; @@ -110,7 +110,7 @@ public: history_size = new_size; history_duration = new_duration; } - void set_slow_op_size_and_threshold(size_t new_size, uint32_t new_threshold) { + void set_slow_op_size_and_threshold(size_t new_size, float new_threshold) { history_slow_op_size = new_size; history_slow_op_threshold = new_threshold; } @@ -139,7 +139,7 @@ public: void set_history_size_and_duration(uint32_t new_size, uint32_t new_duration) { history.set_size_and_duration(new_size, new_duration); } - void set_history_slow_op_size_and_threshold(uint32_t new_size, uint32_t new_threshold) { + void set_history_slow_op_size_and_threshold(uint32_t new_size, float new_threshold) { history.set_slow_op_size_and_threshold(new_size, new_threshold); } bool is_tracking() const { -- 2.39.5