Back to home page

EIC code displayed by LXR

 
 

    


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

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_SAMPLE_ANALYSIS_HPP_INCLUDED
0011 #define CATCH_SAMPLE_ANALYSIS_HPP_INCLUDED
0012 
0013 #include <catch2/benchmark/catch_estimate.hpp>
0014 #include <catch2/benchmark/catch_outlier_classification.hpp>
0015 #include <catch2/internal/catch_move_and_forward.hpp>
0016 
0017 #include <vector>
0018 
0019 namespace Catch {
0020     namespace Benchmark {
0021         template <typename Duration>
0022         struct SampleAnalysis {
0023             std::vector<Duration> samples;
0024             Estimate<Duration> mean;
0025             Estimate<Duration> standard_deviation;
0026             OutlierClassification outliers;
0027             double outlier_variance;
0028 
0029             template <typename Duration2>
0030             operator SampleAnalysis<Duration2>() const {
0031                 std::vector<Duration2> samples2;
0032                 samples2.reserve(samples.size());
0033                 for (auto const& d : samples) {
0034                     samples2.push_back(Duration2(d));
0035                 }
0036                 return {
0037                     CATCH_MOVE(samples2),
0038                     mean,
0039                     standard_deviation,
0040                     outliers,
0041                     outlier_variance,
0042                 };
0043             }
0044         };
0045     } // namespace Benchmark
0046 } // namespace Catch
0047 
0048 #endif // CATCH_SAMPLE_ANALYSIS_HPP_INCLUDED