1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
6 #include "common/perf_counters.h"
7 #include "include/common_fwd.h"
8 #include <seastar/core/sharded.hh>
10 using crimson::common::PerfCountersCollectionImpl
;
11 namespace crimson::common
{
12 class PerfCountersCollection
: public seastar::sharded
<PerfCountersCollection
>
14 using ShardedPerfCountersCollection
= seastar::sharded
<PerfCountersCollection
>;
17 std::unique_ptr
<PerfCountersCollectionImpl
> perf_collection
;
18 static ShardedPerfCountersCollection sharded_perf_coll
;
19 friend PerfCountersCollection
& local_perf_coll();
20 friend ShardedPerfCountersCollection
& sharded_perf_coll();
23 PerfCountersCollection();
24 ~PerfCountersCollection();
25 PerfCountersCollectionImpl
* get_perf_collection();
26 void dump_formatted(ceph::Formatter
*f
, bool schema
,
27 const std::string
&logger
= "",
28 const std::string
&counter
= "");
31 inline PerfCountersCollection::ShardedPerfCountersCollection
& sharded_perf_coll(){
32 return PerfCountersCollection::sharded_perf_coll
;
35 inline PerfCountersCollection
& local_perf_coll() {
36 return PerfCountersCollection::sharded_perf_coll
.local();
39 class PerfCountersDeleter
{
43 PerfCountersDeleter() noexcept
: cct(nullptr) {}
44 PerfCountersDeleter(CephContext
* cct
) noexcept
: cct(cct
) {}
45 void operator()(PerfCounters
* p
) noexcept
;
48 using PerfCountersRef
= std::unique_ptr
<crimson::common::PerfCounters
, crimson::common::PerfCountersDeleter
>;