27 return fName + kFieldSeperator + fUnit + kFieldSeperator + fDescription + kFieldSeperator + GetValueAsString();
32 return GetLocalCounter(
name) !=
nullptr;
38 for (
const auto &
c : fCounters) {
39 if (
c->GetName() ==
name)
48 std::string prefix = fName +
".";
49 if (
name.compare(0, prefix.length(), std::string_view(prefix)) != 0)
53 if (
auto counter = GetLocalCounter(
innerName))
56 for (
auto m : fObservedMetrics) {
58 if (counter !=
nullptr)
68 output << fName <<
" metrics disabled!" << std::endl;
72 for (
const auto &
c : fCounters) {
73 output << prefix << fName << kNamespaceSeperator <<
c->ToString() << std::endl;
75 for (
const auto c : fObservedMetrics) {
76 c->Print(output, prefix + fName +
".");
82 for (
auto &
c: fCounters)
85 for (
auto m: fObservedMetrics)
91 fObservedMetrics.push_back(&
observee);
A collection of Counter objects with a name, a unit, and a description.
const RNTuplePerfCounter * GetCounter(std::string_view name) const
Searches this object and all the observed sub metrics.
void ObserveMetrics(RNTupleMetrics &observee)
const RNTuplePerfCounter * GetLocalCounter(std::string_view name) const
Searches counters registered in this object only. Returns nullptr if name is not found.
bool Contains(const std::string &name) const
void Print(std::ostream &output, const std::string &prefix="") const
A performance counter with a name and a unit, which can be activated on demand.
std::string ToString() const
virtual ~RNTuplePerfCounter()