MCPcopy Create free account
hub / github.com/Dobiasd/FunctionalPlus / bench_void_function_impl

Class bench_void_function_impl

include/fplus/benchmark_session.hpp:116–144  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

114
115 template <typename Fn>
116 class bench_void_function_impl {
117 public:
118 explicit bench_void_function_impl(
119 benchmark_session& benchmark_sess,
120 FunctionName function_name,
121 Fn fn)
122 : benchmark_session_(benchmark_sess)
123 , function_name_(function_name)
124 , fn_(fn) {};
125
126 template <typename... Args>
127 auto operator()(Args&&... args)
128 {
129 _bench_result(std::forward<Args>(args)...);
130 }
131
132 private:
133 template <typename... Args>
134 auto _bench_result(Args&&... args)
135 {
136 fplus::stopwatch timer;
137 fn_(std::forward<Args>(args)...);
138 benchmark_session_.store_one_time(function_name_, timer.elapsed());
139 }
140
141 benchmark_session& benchmark_session_;
142 FunctionName function_name_;
143 Fn fn_;
144 };
145
146} // namespace internal
147

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected