]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
common/Finisher: use fmt to build strings
authorMax Kellermann <max.kellermann@ionos.com>
Wed, 9 Oct 2024 12:27:34 +0000 (14:27 +0200)
committerMax Kellermann <max.kellermann@ionos.com>
Thu, 10 Oct 2024 05:32:57 +0000 (07:32 +0200)
This is not only more efficient at runtime, but also shaves 500 bytes
code off the binary.

Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
src/common/Finisher.cc

index 5f0557306ce35608122afa438999c1f63205bb8f..c6d3746d8c0540bc9c8229f6df54b7a9ea278a41 100644 (file)
@@ -4,6 +4,8 @@
 #include "Finisher.h"
 #include "common/perf_counters.h"
 
+#include <fmt/core.h>
+
 #define dout_subsys ceph_subsys_finisher
 #undef dout_prefix
 #define dout_prefix *_dout << "finisher(" << this << ") "
@@ -14,10 +16,10 @@ Finisher::Finisher(CephContext *cct_) :
   finisher_thread(this) {}
 
 Finisher::Finisher(CephContext *cct_, std::string name, std::string tn) :
-  cct(cct_), finisher_lock(ceph::make_mutex("Finisher::" + name)),
+  cct(cct_), finisher_lock(ceph::make_mutex(fmt::format("Finisher::{}", name))),
   thread_name(tn),
   finisher_thread(this) {
-  PerfCountersBuilder b(cct, std::string("finisher-") + name,
+  PerfCountersBuilder b(cct, fmt::format("finisher-{}", name),
                        l_finisher_first, l_finisher_last);
   b.add_u64(l_finisher_queue_len, "queue_len");
   b.add_time_avg(l_finisher_complete_lat, "complete_latency");