mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-27 07:18:33 +02:00
bench: introduce -min_time argument
When it is not easily possible to stabilize benchmark machine and code the argument -min_time can be used to specify a minimum duration that a benchmark should take. E.g. choose -min_time=1000 if you are willing to wait about 1 second for each benchmark result. The default is now set to 10ms instead of 0, which should make runs on fast machines more stable with negligible slowdown.
This commit is contained in:
@@ -61,6 +61,12 @@ void benchmark::BenchRunner::RunAll(const Args& args)
|
||||
|
||||
Bench bench;
|
||||
bench.name(p.first);
|
||||
if (args.min_time > 0ms) {
|
||||
// convert to nanos before dividing to reduce rounding errors
|
||||
std::chrono::nanoseconds min_time_ns = args.min_time;
|
||||
bench.minEpochTime(min_time_ns / bench.epochs());
|
||||
}
|
||||
|
||||
if (args.asymptote.empty()) {
|
||||
p.second(bench);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user