aboutsummaryrefslogtreecommitdiff
path: root/src/benchmark_runner.cc
diff options
context:
space:
mode:
authorBaaMeow <38274252+BaaMeow@users.noreply.github.com>2019-03-26 05:53:07 -0400
committerDominic Hamon <dominichamon@users.noreply.github.com>2019-03-26 09:53:07 +0000
commit478eafa36bb8763e04c61d88bb2b8e9fa3440b82 (patch)
tree0f8aa85e9d6efa1bc0896f13ad6e56fecd5dbb3b /src/benchmark_runner.cc
parentfae87266906c10fc055eb270eddc622404696e63 (diff)
downloadgoogle-benchmark-478eafa36bb8763e04c61d88bb2b8e9fa3440b82.tar.gz
[JSON] add threads and repetitions to the json output (#748)
* [JSON] add threads and repetitions to the json output, for better ide… [Tests] explicitly check for thread == 1 [Tests] specifically mark all repetition checks [JSON] add repetition_index reporting, but only for non-aggregates (i… * [Formatting] Be very, very explicit about pointer alignment so clang-format can not put pointers/references on the wrong side of arguments. [Benchmark::Run] Make sure to use explanatory sentinel variable rather than a magic number. * Do not pass redundant information
Diffstat (limited to 'src/benchmark_runner.cc')
-rw-r--r--src/benchmark_runner.cc17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/benchmark_runner.cc b/src/benchmark_runner.cc
index 9e1f6e4..f4ea5f2 100644
--- a/src/benchmark_runner.cc
+++ b/src/benchmark_runner.cc
@@ -64,7 +64,8 @@ static const size_t kMaxIterations = 1000000000;
BenchmarkReporter::Run CreateRunReport(
const benchmark::internal::BenchmarkInstance& b,
const internal::ThreadManager::Result& results, size_t memory_iterations,
- const MemoryManager::Result& memory_result, double seconds) {
+ const MemoryManager::Result& memory_result, double seconds,
+ int64_t repetition_index) {
// Create report about this benchmark run.
BenchmarkReporter::Run report;
@@ -75,6 +76,9 @@ BenchmarkReporter::Run CreateRunReport(
// This is the total iterations across all threads.
report.iterations = results.iterations;
report.time_unit = b.time_unit;
+ report.threads = b.threads;
+ report.repetition_index = repetition_index;
+ report.repetitions = b.repetitions;
if (!report.error_occurred) {
if (b.use_manual_time) {
@@ -150,8 +154,7 @@ class BenchmarkRunner {
}
for (int repetition_num = 0; repetition_num < repeats; repetition_num++) {
- const bool is_the_first_repetition = repetition_num == 0;
- DoOneRepetition(is_the_first_repetition);
+ DoOneRepetition(repetition_num);
}
// Calculate additional statistics
@@ -276,7 +279,8 @@ class BenchmarkRunner {
((i.results.real_time_used >= 5 * min_time) && !b.use_manual_time);
}
- void DoOneRepetition(bool is_the_first_repetition) {
+ void DoOneRepetition(int64_t repetition_index) {
+ const bool is_the_first_repetition = repetition_index == 0;
IterationResults i;
// We *may* be gradually increasing the length (iteration count)
@@ -326,8 +330,9 @@ class BenchmarkRunner {
}
// Ok, now actualy report.
- BenchmarkReporter::Run report = CreateRunReport(
- b, i.results, memory_iterations, memory_result, i.seconds);
+ BenchmarkReporter::Run report =
+ CreateRunReport(b, i.results, memory_iterations, memory_result,
+ i.seconds, repetition_index);
if (!report.error_occurred && b.complexity != oNone)
complexity_reports.push_back(report);