| The Gaudi Framework v32r1 (f65d50dc)

Public Member Functions | Private Attributes | List of all members
CounterHolder< BASE > Class Template Reference

`#include <GaudiKernel/CounterHolder.h>`

Inheritance diagram for CounterHolder< BASE >:
[legend]
Collaboration diagram for CounterHolder< BASE >:
[legend]

## Public Member Functions
void | declareCounter (const std::string &tag, Gaudi::Accumulators::PrintableCounter &r)
const Gaudi::Accumulators::PrintableCounter * | findCounter (const std::string &tag) const
template<typename Callable >
void | forEachCounter (Callable &&f) const
int | nCounters () const
std::size_t | nOfCountersToBePrinted ()
void | clearCounters ()

## Private Attributes
std::map< std::string, std::reference_wrapper< Gaudi::Accumulators::PrintableCounter > > | m_counters
std::mutex | m_mutex

## Detailed Description

### template<class BASE>
class CounterHolder< BASE >

Definition at line 16 of file CounterHolder.h.

## Member Function Documentation

## ◆ clearCounters()

template<class BASE>

void CounterHolder< BASE >::clearCounters | ( |  | ) |
| inline

Definition at line 52 of file CounterHolder.h.

52 {
53 std::lock_guard lock{m_mutex};
54 m_counters.clear();
55 }
CounterHolder::m_mutex
std::mutex m_mutex
Definition: CounterHolder.h:59
std::lock
T lock(T... args)
std::map::clear
T clear(T... args)
std::lock_guard
CounterHolder::m_counters
std::map< std::string, std::reference_wrapper< Gaudi::Accumulators::PrintableCounter > > m_counters
Definition: CounterHolder.h:58

## ◆ declareCounter()

template<class BASE>

void CounterHolder< BASE >::declareCounter | ( | const std::string & | tag,
|  | Gaudi::Accumulators::PrintableCounter & | r
| ) |  |
| inline

Definition at line 23 of file CounterHolder.h.

23 {
24 std::lock_guard lock{m_mutex};
25 m_counters.emplace( tag, r );
26 }
CounterHolder::m_mutex
std::mutex m_mutex
Definition: CounterHolder.h:59
std::lock
T lock(T... args)
std::lock_guard
std::map::emplace
T emplace(T... args)
CounterHolder::m_counters
std::map< std::string, std::reference_wrapper< Gaudi::Accumulators::PrintableCounter > > m_counters
Definition: CounterHolder.h:58

## ◆ findCounter()

template<class BASE>

const Gaudi::Accumulators::PrintableCounter* CounterHolder< BASE >::findCounter | ( | const std::string & | tag | ) | const
| inline

Definition at line 28 of file CounterHolder.h.

28 {
29 std::lock_guard lock{m_mutex};
30 auto p = m_counters.find( tag );
31 return p != m_counters.end() ? &p->second.get() : nullptr;
32 }
CounterHolder::m_mutex
std::mutex m_mutex
Definition: CounterHolder.h:59
std::map::end
T end(T... args)
std::lock
T lock(T... args)
std::reference_wrapper::get
T get(T... args)
std::map::find
T find(T... args)
std::lock_guard
CounterHolder::m_counters
std::map< std::string, std::reference_wrapper< Gaudi::Accumulators::PrintableCounter > > m_counters
Definition: CounterHolder.h:58

## ◆ forEachCounter()

template<class BASE>
template<typename Callable >

void CounterHolder< BASE >::forEachCounter | ( | Callable && | f | ) | const
| inline

Definition at line 35 of file CounterHolder.h.

35 {
36 std::lock_guard lock{m_mutex};
37 std::for_each( m_counters.begin(), m_counters.end(),
38 [f = std::forward<Callable>( f )]( const auto& p ) { std::invoke( f, p.first, p.second.get() ); } );
39 }
CounterHolder::m_mutex
std::mutex m_mutex
Definition: CounterHolder.h:59
std::map::end
T end(T... args)
std::lock
T lock(T... args)
std::lock_guard
std::map::begin
T begin(T... args)
std::for_each
T for_each(T... args)
CounterHolder::m_counters
std::map< std::string, std::reference_wrapper< Gaudi::Accumulators::PrintableCounter > > m_counters
Definition: CounterHolder.h:58

## ◆ nCounters()

template<class BASE>

int CounterHolder< BASE >::nCounters | ( |  | ) | const
| inline

Definition at line 41 of file CounterHolder.h.

41 {
42 std::lock_guard lock{m_mutex};
43 return m_counters.size();
44 }
CounterHolder::m_mutex
std::mutex m_mutex
Definition: CounterHolder.h:59
std::lock
T lock(T... args)
std::map::size
T size(T... args)
std::lock_guard
CounterHolder::m_counters
std::map< std::string, std::reference_wrapper< Gaudi::Accumulators::PrintableCounter > > m_counters
Definition: CounterHolder.h:58

## ◆ nOfCountersToBePrinted()

template<class BASE>

std::size_t CounterHolder< BASE >::nOfCountersToBePrinted | ( |  | ) |
| inline

Definition at line 46 of file CounterHolder.h.

46 {
47 std::lock_guard lock{m_mutex};
48 return count_if( begin( m_counters ), end( m_counters ),
49 []( const auto& c ) { return c.second.get().toBePrinted(); } );
50 }
CounterHolder::m_mutex
std::mutex m_mutex
Definition: CounterHolder.h:59
gaudirun.c
c
Definition: gaudirun.py:487
std::lock
T lock(T... args)
IOTest.end
def end
Definition: IOTest.py:112
std::count_if
T count_if(T... args)
std::lock_guard
Gaudi::Utils::begin
AttribStringParser::Iterator begin(const AttribStringParser &parser)
Definition: AttribStringParser.h:120
CounterHolder::m_counters
std::map< std::string, std::reference_wrapper< Gaudi::Accumulators::PrintableCounter > > m_counters
Definition: CounterHolder.h:58

## Member Data Documentation

## ◆ m_counters

template<class BASE>

std::map<std::string, std::reference_wrapper<Gaudi::Accumulators::PrintableCounter> > CounterHolder< BASE >::m_counters
| private

Definition at line 58 of file CounterHolder.h.

## ◆ m_mutex

template<class BASE>

std::mutex CounterHolder< BASE >::m_mutex
| mutable private

Definition at line 59 of file CounterHolder.h.

The documentation for this class was generated from the following file:

- GaudiKernel/GaudiKernel/CounterHolder.h