This should improve the compilation times by decreasing the number of TUs compiled, without making overly big TUs that would cause problems with heavy-tailed compilation times. There is one "combined TU" for the top level part, and each subpart, except for Reporters, which currently do not have any trivial TUs.
89 lines
2.7 KiB
C++
89 lines
2.7 KiB
C++
/** \file
|
|
* This is a special TU that combines what would otherwise be a very
|
|
* small benchmarking-related TUs into one bigger TU.
|
|
*
|
|
* The reason for this is compilation performance improvements by
|
|
* avoiding reparsing headers for many small TUs, instead having this
|
|
* one TU include bit more, but having it all parsed only once.
|
|
*
|
|
* To avoid heavy-tail problem with compilation times, each "subpart"
|
|
* of Catch2 has its own combined TU like this.
|
|
*/
|
|
|
|
////////////////////////////////////////////
|
|
// vvv formerly catch_chronometer.cpp vvv //
|
|
////////////////////////////////////////////
|
|
|
|
#include <catch2/benchmark/catch_chronometer.hpp>
|
|
|
|
namespace Catch {
|
|
namespace Benchmark {
|
|
namespace Detail {
|
|
ChronometerConcept::~ChronometerConcept() = default;
|
|
} // namespace Detail
|
|
} // namespace Benchmark
|
|
} // namespace Catch
|
|
|
|
|
|
///////////////////////////////////////////////////
|
|
// vvv formerly catch_benchmark_function.cpp vvv //
|
|
///////////////////////////////////////////////////
|
|
|
|
#include <catch2/benchmark/detail/catch_benchmark_function.hpp>
|
|
|
|
namespace Catch {
|
|
namespace Benchmark {
|
|
namespace Detail {
|
|
BenchmarkFunction::callable::~callable() = default;
|
|
} // namespace Detail
|
|
} // namespace Benchmark
|
|
} // namespace Catch
|
|
|
|
|
|
////////////////////////////////////////////////
|
|
// vvv formerly catch_complete_invoke.cpp vvv //
|
|
////////////////////////////////////////////////
|
|
|
|
#include <catch2/benchmark/detail/catch_complete_invoke.hpp>
|
|
|
|
namespace Catch {
|
|
namespace Benchmark {
|
|
namespace Detail {
|
|
CATCH_INTERNAL_START_WARNINGS_SUPPRESSION
|
|
CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS
|
|
const std::string benchmarkErrorMsg = "a benchmark failed to run successfully";
|
|
CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION
|
|
} // namespace Detail
|
|
} // namespace Benchmark
|
|
} // namespace Catch
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////
|
|
// vvv formerly catch_run_for_at_least.cpp vvv //
|
|
/////////////////////////////////////////////////
|
|
|
|
#include <catch2/benchmark/detail/catch_run_for_at_least.hpp>
|
|
#include <exception>
|
|
#include <catch2/internal/catch_enforce.hpp>
|
|
|
|
namespace Catch {
|
|
namespace Benchmark {
|
|
namespace Detail {
|
|
struct optimized_away_error : std::exception {
|
|
const char* what() const noexcept override;
|
|
};
|
|
|
|
const char* optimized_away_error::what() const noexcept {
|
|
return "could not measure benchmark, maybe it was optimized away";
|
|
}
|
|
|
|
void throw_optimized_away_error() {
|
|
Catch::throw_exception(optimized_away_error{});
|
|
}
|
|
|
|
} // namespace Detail
|
|
} // namespace Benchmark
|
|
} // namespace Catch
|