diff --git a/src/crypto/kdf/Kdf.cpp b/src/crypto/kdf/Kdf.cpp index b4c4427c8..6a4c7fc62 100644 --- a/src/crypto/kdf/Kdf.cpp +++ b/src/crypto/kdf/Kdf.cpp @@ -71,16 +71,19 @@ void Kdf::randomizeSeed() int Kdf::benchmark(int msec) const { - BenchmarkThread thread1(msec, this); - BenchmarkThread thread2(msec, this); + // Run the benchmark twice using half the time for each run + BenchmarkThread thread(msec / 2, this); + int rounds = 0; - thread1.start(); - thread2.start(); + thread.start(); + thread.wait(); + rounds += thread.rounds(); - thread1.wait(); - thread2.wait(); + thread.start(); + thread.wait(); + rounds += thread.rounds(); - return qMax(1, (thread1.rounds() + thread2.rounds()) / 2); + return qMax(1, rounds); } Kdf::BenchmarkThread::BenchmarkThread(int msec, const Kdf* kdf)