summaryrefslogtreecommitdiffstats
path: root/src/crimson/common/perf_counters_collection.cc
blob: 254d85278f648fe05f12682c73027cb30cd8ee57 (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
38
39
40
41
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab

#include "common/ceph_context.h"
#include "perf_counters_collection.h"

namespace crimson::common {
PerfCountersCollection::PerfCountersCollection()
{
  perf_collection = std::make_unique<PerfCountersCollectionImpl>();
}
PerfCountersCollection::~PerfCountersCollection()
{
  perf_collection->clear();
}

PerfCountersCollectionImpl* PerfCountersCollection:: get_perf_collection()
{
  return perf_collection.get();
}

void PerfCountersCollection::dump_formatted(ceph::Formatter *f, bool schema,
                                            bool dump_labeled,
                                            const std::string &logger,
                                            const std::string &counter)
{
  perf_collection->dump_formatted(f, schema, dump_labeled, logger, counter);
}

PerfCountersCollection::ShardedPerfCountersCollection PerfCountersCollection::sharded_perf_coll;

void PerfCountersDeleter::operator()(PerfCounters* p) noexcept
{
  if (cct) {
    cct->get_perfcounters_collection()->remove(p);
  }
  delete p;
}

}