diff --git a/src/benchmark_runner.cc b/src/benchmark_runner.cc index fb688672a..94c86e264 100644 --- a/src/benchmark_runner.cc +++ b/src/benchmark_runner.cc @@ -123,12 +123,7 @@ BenchmarkReporter::Run CreateRunReport( : 0; } - // The CPU time is the total time taken by all thread. If we used that as - // the denominator, we'd be calculating the rate per thread here. This is - // why we have to divide the total cpu_time by the number of threads for - // global counters to get a global rate. - const double thread_seconds = seconds / b.threads(); - internal::Finish(&report.counters, results.iterations, thread_seconds, + internal::Finish(&report.counters, results.iterations, seconds, b.threads()); } return report; @@ -361,6 +356,9 @@ BenchmarkRunner::IterationResults BenchmarkRunner::DoNIterations() { } else if (b.use_real_time()) { i.seconds = i.results.real_time_used; } + // The time is the sum over all threads, we want each of them to run the + // specificed minimum time. + i.seconds /= b.threads(); return i; }