16#ifndef ROOT7_RNTupleMetrics
17#define ROOT7_RNTupleMetrics
37namespace Experimental {
188 return std::numeric_limits<double>::quiet_NaN();
192 return static_cast<std::int64_t
>(
GetValue());
209template <
typename BaseCounterT>
219 auto ticks = BaseCounterT::GetValue();
220 return std::uint64_t((
double(ticks) /
double(CLOCKS_PER_SEC)) * (1000. * 1000. * 1000.));
238template <
typename WallTimeT,
typename CpuTimeT>
263 auto wallTimeNs = std::chrono::duration_cast<std::chrono::nanoseconds>(Clock_t::now() -
fStartTime);
290 std::vector<std::unique_ptr<RNTuplePerfCounter>>
fCounters;
306 template <
typename CounterPtrT,
class... Args>
310 auto counter = std::make_unique<std::remove_pointer_t<CounterPtrT>>(
name, std::forward<Args>(args)...);
311 auto ptrCounter = counter.get();
312 fCounters.emplace_back(std::move(counter));
324 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)
std::string GetValueAsString() const override
std::int64_t GetValueAsInt() const override
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
A metric element that computes its floating point value from other counters.
std::int64_t GetValueAsInt() const override
RNTupleMetrics & fMetrics
std::function< std::pair< bool, double >(const RNTupleMetrics &)> MetricFunc_t
std::string GetValueAsString() const override
RNTupleCalcPerf(const std::string &name, const std::string &unit, const std::string &desc, RNTupleMetrics &metrics, MetricFunc_t &&func)
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.
RNTupleMetrics & operator=(const RNTupleMetrics &other)=delete
void ObserveMetrics(RNTupleMetrics &observee)
RNTupleMetrics & operator=(RNTupleMetrics &&other)=default
const RNTuplePerfCounter * GetLocalCounter(std::string_view name) const
Searches counters registered in this object only. Returns nullptr if name is not found.
~RNTupleMetrics()=default
std::vector< std::unique_ptr< RNTuplePerfCounter > > fCounters
RNTupleMetrics(RNTupleMetrics &&other)=default
CounterPtrT MakeCounter(const std::string &name, Args &&... args)
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.
virtual std::string GetValueAsString() const =0
static constexpr char kFieldSeperator
Symbol to split name, unit, description, and value when printing.
virtual std::int64_t GetValueAsInt() const =0
RNTuplePerfCounter(const std::string &name, const std::string &unit, const std::string &desc)
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::int64_t GetValueAsInt() const override
R__ALWAYS_INLINE void Add(int64_t delta)
R__ALWAYS_INLINE void Inc()
R__ALWAYS_INLINE void Dec()
std::string GetValueAsString() const override
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 GetValueAsString() const final
std::int64_t GetValueAsInt() 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)