Skip to content

Commit 12e0c26

Browse files
committed
common/Finisher: use fmt to build strings
This is not only more efficient at runtime, but also shaves 500 bytes code off the binary. Signed-off-by: Max Kellermann <[email protected]>
1 parent 3717827 commit 12e0c26

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/common/Finisher.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
#include "Finisher.h"
55
#include "common/perf_counters.h"
66

7+
#include <fmt/core.h>
8+
79
#define dout_subsys ceph_subsys_finisher
810
#undef dout_prefix
911
#define dout_prefix *_dout << "finisher(" << this << ") "
@@ -14,10 +16,10 @@ Finisher::Finisher(CephContext *cct_) :
1416
finisher_thread(this) {}
1517

1618
Finisher::Finisher(CephContext *cct_, std::string name, std::string tn) :
17-
cct(cct_), finisher_lock(ceph::make_mutex("Finisher::" + name)),
19+
cct(cct_), finisher_lock(ceph::make_mutex(fmt::format("Finisher::{}", name))),
1820
thread_name(tn),
1921
finisher_thread(this) {
20-
PerfCountersBuilder b(cct, std::string("finisher-") + name,
22+
PerfCountersBuilder b(cct, fmt::format("finisher-{}", name),
2123
l_finisher_first, l_finisher_last);
2224
b.add_u64(l_finisher_queue_len, "queue_len");
2325
b.add_time_avg(l_finisher_complete_lat, "complete_latency");

0 commit comments

Comments
 (0)