16#ifndef ROOT7_RNTupleMetrics
17#define ROOT7_RNTupleMetrics
34namespace Experimental {
163template <
typename BaseCounterT>
173 auto ticks = BaseCounterT::GetValue();
174 return std::to_string(std::uint64_t(
175 (
double(ticks) /
double(CLOCKS_PER_SEC)) * (1000. * 1000. * 1000.)));
189template <
typename WallTimeT,
typename CpuTimeT>
214 auto wallTimeNs = std::chrono::duration_cast<std::chrono::nanoseconds>(Clock_t::now() -
fStartTime);
241 std::vector<std::unique_ptr<RNTuplePerfCounter>>
fCounters;
254 template <
typename CounterPtrT>
255 CounterPtrT
MakeCounter(
const std::string &
name,
const std::string &unit,
const std::string &desc)
258 auto counter = std::make_unique<std::remove_pointer_t<CounterPtrT>>(
name, unit, desc);
259 auto ptrCounter = counter.get();
260 fCounters.emplace_back(std::move(counter));
266 void Print(std::ostream &
output,
const std::string &prefix =
"")
const;
#define R__unlikely(expr)
A thread-safe integral performance counter.
R__ALWAYS_INLINE void Inc()
R__ALWAYS_INLINE void Dec()
R__ALWAYS_INLINE void SetValue(int64_t val)
std::atomic< std::int64_t > fCounter
R__ALWAYS_INLINE int64_t XAdd(int64_t delta)
RNTupleAtomicCounter(const std::string &name, const std::string &unit, const std::string &desc)
R__ALWAYS_INLINE void Add(int64_t delta)
R__ALWAYS_INLINE int64_t GetValue() const
std::string ValueToString() const override
A collection of Counter objects with a name, a unit, and a description.
RNTupleMetrics & operator=(const RNTupleMetrics &other)=delete
void ObserveMetrics(RNTupleMetrics &observee)
CounterPtrT MakeCounter(const std::string &name, const std::string &unit, const std::string &desc)
~RNTupleMetrics()=default
std::vector< std::unique_ptr< RNTuplePerfCounter > > fCounters
bool Contains(const std::string &name) const
RNTupleMetrics(const std::string &name)
std::vector< RNTupleMetrics * > fObservedMetrics
void Print(std::ostream &output, const std::string &prefix="") const
RNTupleMetrics(const RNTupleMetrics &other)=delete
static constexpr char kNamespaceSeperator
Symbol to split metrics name from counter / sub metrics name.
A performance counter with a name and a unit, which can be activated on demand.
static constexpr char kFieldSeperator
Symbol to split name, unit, description, and value when printing.
RNTuplePerfCounter(const std::string &name, const std::string &unit, const std::string &desc)
virtual std::string ValueToString() const =0
std::string GetUnit() const
std::string ToString() const
std::string GetDescription() const
virtual ~RNTuplePerfCounter()
std::string GetName() const
A non thread-safe integral performance counter.
RNTuplePlainCounter(const std::string &name, const std::string &unit, const std::string &desc)
R__ALWAYS_INLINE int64_t GetValue() const
R__ALWAYS_INLINE void SetValue(int64_t val)
std::string ValueToString() const override
R__ALWAYS_INLINE void Add(int64_t delta)
R__ALWAYS_INLINE void Inc()
R__ALWAYS_INLINE void Dec()
An either thread-safe or non thread safe counter for CPU ticks.
RNTupleTickCounter(const std::string &name, const std::string &unit, const std::string &desc)
std::string ValueToString() const final
Record wall time and CPU time between construction and destruction.
Clock_t::time_point fStartTime
Wall clock time.
RNTupleTimer(WallTimeT &ctrWallTime, CpuTimeT &ctrCpuTicks)
std::chrono::steady_clock Clock_t
clock_t fStartTicks
CPU time.
RNTupleTimer(const RNTupleTimer &other)=delete
RNTupleTimer & operator=(const RNTupleTimer &other)=delete
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
static void output(int code)