PODIO v00-16-03
An Event-Data-Model Toolkit for High Energy Physics Experiments
Loading...
Searching...
No Matches
podio::benchmark Namespace Reference

Classes

class  BenchmarkRecorder
 
class  BenchmarkRecorderTree
 

Typedefs

using ClockT = std::chrono::high_resolution_clock
 

Functions

template<class Obj , typename MemberFunc , typename... Args>
std::pair< std::invoke_result_t< MemberFunc, Obj, Args... >, ClockT::duration > run_member_timed (Obj &obj, MemberFunc func, Args &&... args)
 
template<class Obj , typename MemberFunc , typename... Args>
ClockT::duration run_void_member_timed (Obj &obj, MemberFunc func, Args &&... args)
 

Typedef Documentation

◆ ClockT

using podio::benchmark::ClockT = typedef std::chrono::high_resolution_clock

Definition at line 9 of file BenchmarkUtil.h.

Function Documentation

◆ run_member_timed()

template<class Obj , typename MemberFunc , typename... Args>
std::pair< std::invoke_result_t< MemberFunc, Obj, Args... >, ClockT::duration > podio::benchmark::run_member_timed ( Obj &  obj,
MemberFunc  func,
Args &&...  args 
)
inline

Run a member function and record the duration. Return the result and the duration in a pair.

Definition at line 17 of file BenchmarkUtil.h.

17 {
18 const auto start = ClockT::now();
19 const auto retval = std::invoke(func, obj, std::forward<Args>(args)...);
20 const auto end = ClockT::now();
21
22 return std::make_pair(retval, end - start);
23}

Referenced by podio::TimedReader< WrappedReader >::readCollection().

◆ run_void_member_timed()

template<class Obj , typename MemberFunc , typename... Args>
ClockT::duration podio::benchmark::run_void_member_timed ( Obj &  obj,
MemberFunc  func,
Args &&...  args 
)
inline

Run a member function without return value and record the duration. Return the duration and only use the side-effects of the member function. Can't get this to work in the above version with a void return value, so that is why we have a dedicated function for void functions here.

Definition at line 32 of file BenchmarkUtil.h.

32 {
33 const auto start = ClockT::now();
34 std::invoke(func, obj, std::forward<Args>(args)...);
35 const auto end = ClockT::now();
36
37 return end - start;
38}