Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:02:47

0001 
0002 //              Copyright Catch2 Authors
0003 // Distributed under the Boost Software License, Version 1.0.
0004 //   (See accompanying file LICENSE.txt or copy at
0005 //        https://www.boost.org/LICENSE_1_0.txt)
0006 
0007 // SPDX-License-Identifier: BSL-1.0
0008 // Adapted from donated nonius code.
0009 
0010 #ifndef CATCH_MEASURE_HPP_INCLUDED
0011 #define CATCH_MEASURE_HPP_INCLUDED
0012 
0013 #include <catch2/benchmark/detail/catch_complete_invoke.hpp>
0014 #include <catch2/benchmark/detail/catch_timing.hpp>
0015 #include <catch2/internal/catch_move_and_forward.hpp>
0016 
0017 namespace Catch {
0018     namespace Benchmark {
0019         namespace Detail {
0020             template <typename Clock, typename Fun, typename... Args>
0021             TimingOf<Clock, Fun, Args...> measure(Fun&& fun, Args&&... args) {
0022                 auto start = Clock::now();
0023                 auto&& r = Detail::complete_invoke(fun, CATCH_FORWARD(args)...);
0024                 auto end = Clock::now();
0025                 auto delta = end - start;
0026                 return { delta, CATCH_FORWARD(r), 1 };
0027             }
0028         } // namespace Detail
0029     } // namespace Benchmark
0030 } // namespace Catch
0031 
0032 #endif // CATCH_MEASURE_HPP_INCLUDED