3 #include "common/perf_counters.h"
4 #include "common/ceph_mutex.h"
5 #include "include/common_fwd.h"
7 namespace ceph::common
{
8 class PerfCountersCollection
12 /** Protects perf_impl->m_loggers */
13 mutable ceph::mutex m_lock
;
14 PerfCountersCollectionImpl perf_impl
;
16 PerfCountersCollection(CephContext
*cct
);
17 ~PerfCountersCollection();
18 void add(PerfCounters
*l
);
19 void remove(PerfCounters
*l
);
21 bool reset(const std::string
&name
);
23 void dump_formatted(ceph::Formatter
*f
, bool schema
,
24 const std::string
&logger
= "",
25 const std::string
&counter
= "");
26 void dump_formatted_histograms(ceph::Formatter
*f
, bool schema
,
27 const std::string
&logger
= "",
28 const std::string
&counter
= "");
30 void with_counters(std::function
<void(const PerfCountersCollectionImpl::CounterMap
&)>) const;
32 friend class PerfCountersCollectionTest
;
35 class PerfCountersDeleter
{
39 PerfCountersDeleter() noexcept
: cct(nullptr) {}
40 PerfCountersDeleter(CephContext
* cct
) noexcept
: cct(cct
) {}
41 void operator()(PerfCounters
* p
) noexcept
;
44 using PerfCountersRef
= std::unique_ptr
<ceph::common::PerfCounters
, ceph::common::PerfCountersDeleter
>;