catch_environment.hpp 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * Created by Joachim on 16/04/2019.
  3. * Adapted from donated nonius code.
  4. *
  5. * Distributed under the Boost Software License, Version 1.0. (See accompanying
  6. * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  7. */
  8. // Environment information
  9. #ifndef TWOBLUECUBES_CATCH_ENVIRONMENT_HPP_INCLUDED
  10. #define TWOBLUECUBES_CATCH_ENVIRONMENT_HPP_INCLUDED
  11. #include "catch_clock.hpp"
  12. #include "catch_outlier_classification.hpp"
  13. namespace Catch {
  14. namespace Benchmark {
  15. template <typename Duration>
  16. struct EnvironmentEstimate {
  17. Duration mean;
  18. OutlierClassification outliers;
  19. template <typename Duration2>
  20. operator EnvironmentEstimate<Duration2>() const {
  21. return { mean, outliers };
  22. }
  23. };
  24. template <typename Clock>
  25. struct Environment {
  26. using clock_type = Clock;
  27. EnvironmentEstimate<FloatDuration<Clock>> clock_resolution;
  28. EnvironmentEstimate<FloatDuration<Clock>> clock_cost;
  29. };
  30. } // namespace Benchmark
  31. } // namespace Catch
  32. #endif // TWOBLUECUBES_CATCH_ENVIRONMENT_HPP_INCLUDED