mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 05:16:10 +01:00
Remove superfluous duration_casts from benchmarking
This commit is contained in:
parent
680064d391
commit
64ade68ca2
@ -55,12 +55,12 @@ namespace Catch {
|
|||||||
|
|
||||||
template <typename Clock>
|
template <typename Clock>
|
||||||
int warmup() {
|
int warmup() {
|
||||||
return run_for_at_least<Clock>(std::chrono::duration_cast<IDuration>(warmup_time), warmup_seed, &resolution<Clock>)
|
return run_for_at_least<Clock>(warmup_time, warmup_seed, &resolution<Clock>)
|
||||||
.iterations;
|
.iterations;
|
||||||
}
|
}
|
||||||
template <typename Clock>
|
template <typename Clock>
|
||||||
EnvironmentEstimate estimate_clock_resolution(int iterations) {
|
EnvironmentEstimate estimate_clock_resolution(int iterations) {
|
||||||
auto r = run_for_at_least<Clock>(std::chrono::duration_cast<IDuration>(clock_resolution_estimation_time), iterations, &resolution<Clock>)
|
auto r = run_for_at_least<Clock>(clock_resolution_estimation_time, iterations, &resolution<Clock>)
|
||||||
.result;
|
.result;
|
||||||
return {
|
return {
|
||||||
FDuration(mean(r.data(), r.data() + r.size())),
|
FDuration(mean(r.data(), r.data() + r.size())),
|
||||||
@ -82,7 +82,7 @@ namespace Catch {
|
|||||||
};
|
};
|
||||||
time_clock(1);
|
time_clock(1);
|
||||||
int iters = clock_cost_estimation_iterations;
|
int iters = clock_cost_estimation_iterations;
|
||||||
auto&& r = run_for_at_least<Clock>(std::chrono::duration_cast<IDuration>(clock_cost_estimation_time), iters, time_clock);
|
auto&& r = run_for_at_least<Clock>(clock_cost_estimation_time, iters, time_clock);
|
||||||
std::vector<double> times;
|
std::vector<double> times;
|
||||||
int nsamples = static_cast<int>(std::ceil(time_limit / r.elapsed));
|
int nsamples = static_cast<int>(std::ceil(time_limit / r.elapsed));
|
||||||
times.reserve(static_cast<size_t>(nsamples));
|
times.reserve(static_cast<size_t>(nsamples));
|
||||||
|
Loading…
Reference in New Issue
Block a user