summaryrefslogtreecommitdiffstats
path: root/src/crimson/common/perf_counters_collection.h
blob: a196302470754f96945fe7c91bc4c807f4b54e37 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab

#pragma once

#include "common/perf_counters.h"
#include <seastar/core/sharded.hh>

using crimson::common::PerfCountersCollectionImpl;
namespace crimson::common {
class PerfCountersCollection: public seastar::sharded<PerfCountersCollection>
{
  using ShardedPerfCountersCollection = seastar::sharded<PerfCountersCollection>;

private:
  std::unique_ptr<PerfCountersCollectionImpl> perf_collection;
  static ShardedPerfCountersCollection sharded_perf_coll;
  friend PerfCountersCollection& local_perf_coll();
  friend ShardedPerfCountersCollection& sharded_perf_coll();

public:
  PerfCountersCollection();
  ~PerfCountersCollection();
  PerfCountersCollectionImpl* get_perf_collection();

};

inline PerfCountersCollection::ShardedPerfCountersCollection& sharded_perf_coll(){
  return PerfCountersCollection::sharded_perf_coll;
}

inline PerfCountersCollection& local_perf_coll() {
  return PerfCountersCollection::sharded_perf_coll.local();
}

}