MCPcopy Create free account
hub / github.com/apache/trafficserver / analyse_samples

Function analyse_samples

lib/catch2/catch.hpp:7812–7853  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7810 }
7811
7812 bootstrap_analysis analyse_samples(double confidence_level, int n_resamples, std::vector<double>::iterator first, std::vector<double>::iterator last) {
7813 CATCH_INTERNAL_START_WARNINGS_SUPPRESSION
7814 CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS
7815 static std::random_device entropy;
7816 CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION
7817
7818 auto n = static_cast<int>(last - first); // seriously, one can't use integral types without hell in C++
7819
7820 auto mean = &Detail::mean<std::vector<double>::iterator>;
7821 auto stddev = &standard_deviation;
7822
7823#if defined(CATCH_CONFIG_USE_ASYNC)
7824 auto Estimate = [=](double(*f)(std::vector<double>::iterator, std::vector<double>::iterator)) {
7825 auto seed = entropy();
7826 return std::async(std::launch::async, [=] {
7827 std::mt19937 rng(seed);
7828 auto resampled = resample(rng, n_resamples, first, last, f);
7829 return bootstrap(confidence_level, first, last, resampled, f);
7830 });
7831 };
7832
7833 auto mean_future = Estimate(mean);
7834 auto stddev_future = Estimate(stddev);
7835
7836 auto mean_estimate = mean_future.get();
7837 auto stddev_estimate = stddev_future.get();
7838#else
7839 auto Estimate = [=](double(*f)(std::vector<double>::iterator, std::vector<double>::iterator)) {
7840 auto seed = entropy();
7841 std::mt19937 rng(seed);
7842 auto resampled = resample(rng, n_resamples, first, last, f);
7843 return bootstrap(confidence_level, first, last, resampled, f);
7844 };
7845
7846 auto mean_estimate = Estimate(mean);
7847 auto stddev_estimate = Estimate(stddev);
7848#endif // CATCH_USE_ASYNC
7849
7850 double outlier_variance = Detail::outlier_variance(mean_estimate, stddev_estimate, n);
7851
7852 return { mean_estimate, stddev_estimate, outlier_variance };
7853 }
7854 } // namespace Detail
7855 } // namespace Benchmark
7856} // namespace Catch

Callers 1

analyseFunction · 0.85

Calls 5

resampleFunction · 0.85
bootstrapFunction · 0.85
EstimateClass · 0.85
outlier_varianceFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected