Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions src/benchmark_runner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down
Loading