Various improvements to the benchmarking support
* Units from <ratio> are no longer redeclared in our own namespace * The default clock is `steady_clock`, not `high_resolution_clock`, because, as HH says "high_resolution_clock is useless. If you want measure the passing of time, use steady_clock. If you want user friendly time, use system_clock". * Benchmarking support is opt-in, not opt-out, to avoid the large (~10%) compile time penalty. * Benchmarking-related options in CLI are always present, to decrease the amount of code that is only compiled conditionally and making the whole shebang more maintainble.
This commit is contained in:
parent
ce2560ca95
commit
e340ab8db6
20 changed files with 54 additions and 65 deletions
|
@ -18,10 +18,10 @@
|
|||
#include "catch_option.hpp"
|
||||
#include "catch_stringref.h"
|
||||
|
||||
#ifndef CATCH_CONFIG_DISABLE_BENCHMARKING
|
||||
#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)
|
||||
#include "benchmark/catch_estimate.hpp"
|
||||
#include "benchmark/catch_outlier_classification.hpp"
|
||||
#endif // CATCH_CONFIG_DISABLE_BENCHMARKING
|
||||
#endif // CATCH_CONFIG_ENABLE_BENCHMARKING
|
||||
|
||||
|
||||
#include <string>
|
||||
|
@ -165,7 +165,7 @@ namespace Catch {
|
|||
bool aborting;
|
||||
};
|
||||
|
||||
#ifndef CATCH_CONFIG_DISABLE_BENCHMARKING
|
||||
#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)
|
||||
struct BenchmarkInfo {
|
||||
std::string name;
|
||||
double estimatedDuration;
|
||||
|
@ -201,7 +201,7 @@ namespace Catch {
|
|||
};
|
||||
}
|
||||
};
|
||||
#endif // CATCH_CONFIG_DISABLE_BENCHMARKING
|
||||
#endif // CATCH_CONFIG_ENABLE_BENCHMARKING
|
||||
|
||||
struct IStreamingReporter {
|
||||
virtual ~IStreamingReporter() = default;
|
||||
|
@ -220,12 +220,12 @@ namespace Catch {
|
|||
virtual void testCaseStarting( TestCaseInfo const& testInfo ) = 0;
|
||||
virtual void sectionStarting( SectionInfo const& sectionInfo ) = 0;
|
||||
|
||||
#ifndef CATCH_CONFIG_DISABLE_BENCHMARKING
|
||||
#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)
|
||||
virtual void benchmarkPreparing( std::string const& ) {}
|
||||
virtual void benchmarkStarting( BenchmarkInfo const& ) {}
|
||||
virtual void benchmarkEnded( BenchmarkStats<> const& ) {}
|
||||
virtual void benchmarkFailed( std::string const& ) {}
|
||||
#endif // CATCH_CONFIG_DISABLE_BENCHMARKING
|
||||
#endif // CATCH_CONFIG_ENABLE_BENCHMARKING
|
||||
|
||||
virtual void assertionStarting( AssertionInfo const& assertionInfo ) = 0;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue