1#ifndef PODIO_BENCHMARKUTIL_H
2#define PODIO_BENCHMARKUTIL_H
9using ClockT = std::chrono::high_resolution_clock;
15template <
class Obj,
typename MemberFunc,
typename... Args>
16inline std::pair<std::invoke_result_t<MemberFunc, Obj, Args...>, ClockT::duration>
18 const auto start = ClockT::now();
19 const auto retval = std::invoke(func, obj, std::forward<Args>(args)...);
20 const auto end = ClockT::now();
22 return std::make_pair(retval, end - start);
31template <
class Obj,
typename MemberFunc,
typename... Args>
33 const auto start = ClockT::now();
34 std::invoke(func, obj, std::forward<Args>(args)...);
35 const auto end = ClockT::now();
ClockT::duration run_void_member_timed(Obj &obj, MemberFunc func, Args &&... args)
std::chrono::high_resolution_clock ClockT
std::pair< std::invoke_result_t< MemberFunc, Obj, Args... >, ClockT::duration > run_member_timed(Obj &obj, MemberFunc func, Args &&... args)