]> git.proxmox.com Git - ceph.git/blob - ceph/src/crimson/common/perf_counters_collection.h
import quincy beta 17.1.0
[ceph.git] / ceph / src / crimson / common / perf_counters_collection.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
3
4 #pragma once
5
6 #include "common/perf_counters.h"
7 #include "include/common_fwd.h"
8 #include <seastar/core/sharded.hh>
9
10 using crimson::common::PerfCountersCollectionImpl;
11 namespace crimson::common {
12 class PerfCountersCollection: public seastar::sharded<PerfCountersCollection>
13 {
14 using ShardedPerfCountersCollection = seastar::sharded<PerfCountersCollection>;
15
16 private:
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();
21
22 public:
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 = "");
29 };
30
31 inline PerfCountersCollection::ShardedPerfCountersCollection& sharded_perf_coll(){
32 return PerfCountersCollection::sharded_perf_coll;
33 }
34
35 inline PerfCountersCollection& local_perf_coll() {
36 return PerfCountersCollection::sharded_perf_coll.local();
37 }
38
39 class PerfCountersDeleter {
40 CephContext* cct;
41
42 public:
43 PerfCountersDeleter() noexcept : cct(nullptr) {}
44 PerfCountersDeleter(CephContext* cct) noexcept : cct(cct) {}
45 void operator()(PerfCounters* p) noexcept;
46 };
47 }
48 using PerfCountersRef = std::unique_ptr<crimson::common::PerfCounters, crimson::common::PerfCountersDeleter>;
49