From 3053d1bc8329c9707305677c19c76ba3361c942c Mon Sep 17 00:00:00 2001 From: Dominic Hamon Date: Wed, 7 Aug 2024 15:07:10 +0100 Subject: [PATCH 1/7] Introduce per-thread times to console and json reporters See #1834 for detailed description of why this is useful. --- src/console_reporter.cc | 24 ++++++++----- src/json_reporter.cc | 14 ++++++++ test/complexity_test.cc | 4 +-- test/output_test_helper.cc | 14 ++++---- test/reporter_output_test.cc | 56 +++++++++++++++++------------- test/user_counters_tabular_test.cc | 43 ++++++++++++++++++----- test/user_counters_test.cc | 2 +- 7 files changed, 104 insertions(+), 53 deletions(-) diff --git a/src/console_reporter.cc b/src/console_reporter.cc index 35c3de2a4d..10edacff98 100644 --- a/src/console_reporter.cc +++ b/src/console_reporter.cc @@ -59,9 +59,9 @@ bool ConsoleReporter::ReportContext(const Context& context) { BENCHMARK_EXPORT void ConsoleReporter::PrintHeader(const Run& run) { - std::string str = - FormatString("%-*s %13s %15s %12s", static_cast(name_field_width_), - "Benchmark", "Time", "CPU", "Iterations"); + std::string str = FormatString( + "%-*s %13s %15s %15s %12s", static_cast(name_field_width_), + "Benchmark", "Time", "Per-Thread Time", "CPU", "Iterations"); if (!run.counters.empty()) { if (output_options_ & OO_Tabular) { for (auto const& c : run.counters) { @@ -151,26 +151,32 @@ void ConsoleReporter::PrintRunData(const Run& result) { } const double real_time = result.GetAdjustedRealTime(); + const double per_thread_real_time = + real_time * static_cast(result.threads); const double cpu_time = result.GetAdjustedCPUTime(); const std::string real_time_str = FormatTime(real_time); + const std::string per_thread_real_time_str = FormatTime(per_thread_real_time); const std::string cpu_time_str = FormatTime(cpu_time); if (result.report_big_o) { std::string big_o = GetBigOString(result.complexity); - printer(Out, COLOR_YELLOW, "%10.2f %-4s %10.2f %-4s ", real_time, - big_o.c_str(), cpu_time, big_o.c_str()); + printer(Out, COLOR_YELLOW, "%10.2f %-4s %10.2f %-4s %10.2f %-4s ", + real_time, big_o.c_str(), per_thread_real_time, big_o.c_str(), + cpu_time, big_o.c_str()); } else if (result.report_rms) { - printer(Out, COLOR_YELLOW, "%10.0f %-4s %10.0f %-4s ", real_time * 100, "%", + printer(Out, COLOR_YELLOW, "%10.0f %-4s %10.0f %-4s %10.0f %-4s ", + real_time * 100, "%", per_thread_real_time * 100, "%", cpu_time * 100, "%"); } else if (result.run_type != Run::RT_Aggregate || result.aggregate_unit == StatisticUnit::kTime) { const char* timeLabel = GetTimeUnitString(result.time_unit); - printer(Out, COLOR_YELLOW, "%s %-4s %s %-4s ", real_time_str.c_str(), + printer(Out, COLOR_YELLOW, "%s %-4s %s %-4s %s %-4s ", + real_time_str.c_str(), timeLabel, per_thread_real_time_str.c_str(), timeLabel, cpu_time_str.c_str(), timeLabel); } else { assert(result.aggregate_unit == StatisticUnit::kPercentage); - printer(Out, COLOR_YELLOW, "%10.2f %-4s %10.2f %-4s ", - (100. * result.real_accumulated_time), "%", + printer(Out, COLOR_YELLOW, "%10.2f %-4s %10s %-4s %10.2f %-4s ", + (100. * result.real_accumulated_time), "%", " ", " ", (100. * result.cpu_accumulated_time), "%"); } diff --git a/src/json_reporter.cc b/src/json_reporter.cc index b8c8c94c08..b65a2ca798 100644 --- a/src/json_reporter.cc +++ b/src/json_reporter.cc @@ -274,11 +274,25 @@ void JSONReporter::PrintRunData(Run const& run) { run.aggregate_unit == StatisticUnit::kTime) { out << indent << FormatKV("real_time", run.GetAdjustedRealTime()) << ",\n"; + if (run.threads != 1) { + out << indent + << FormatKV( + "per_thread_real_time", + run.GetAdjustedRealTime() * static_cast(run.threads)) + << ",\n"; + } out << indent << FormatKV("cpu_time", run.GetAdjustedCPUTime()); } else { assert(run.aggregate_unit == StatisticUnit::kPercentage); out << indent << FormatKV("real_time", run.real_accumulated_time) << ",\n"; + if (run.threads != 1) { + out << indent + << FormatKV( + "per_thread_real_time", + run.real_accumulated_time * static_cast(run.threads)) + << ",\n"; + } out << indent << FormatKV("cpu_time", run.cpu_accumulated_time); } out << ",\n" diff --git a/test/complexity_test.cc b/test/complexity_test.cc index 0729d15aa7..268cffedcf 100644 --- a/test/complexity_test.cc +++ b/test/complexity_test.cc @@ -25,9 +25,9 @@ int AddComplexityTest(const std::string &test_name, {"%rms", "[ ]*[0-9]+ %"}}); AddCases( TC_ConsoleOut, - {{"^%bigo_name %bigo_str %bigo_str[ ]*$"}, + {{"^%bigo_name %bigo_str %bigo_str %bigo_str[ ]*$"}, {"^%bigo_name", MR_Not}, // Assert we we didn't only matched a name. - {"^%rms_name %rms %rms[ ]*$", MR_Next}}); + {"^%rms_name %rms %rms %rms[ ]*$", MR_Next}}); AddCases( TC_JSONOut, {{"\"name\": \"%bigo_name\",$"}, diff --git a/test/output_test_helper.cc b/test/output_test_helper.cc index 265f28aae7..cc61bb9c3c 100644 --- a/test/output_test_helper.cc +++ b/test/output_test_helper.cc @@ -50,14 +50,14 @@ SubMap& GetSubstitutions() { {"%int", "[ ]*[0-9]+"}, {" %s ", "[ ]+"}, {"%time", "[ ]*" + time_re + "[ ]+ns"}, - {"%console_report", "[ ]*" + time_re + "[ ]+ns [ ]*" + time_re + "[ ]+ns [ ]*[0-9]+"}, + {"%console_report", "[ ]*" + time_re + "[ ]+ns [ ]*" + time_re + "[ ]+ns [ ]*" + time_re + "[ ]+ns [ ]*[0-9]+"}, {"%console_percentage_report", "[ ]*" + percentage_re + "[ ]+% [ ]*" + percentage_re + "[ ]+% [ ]*[0-9]+"}, - {"%console_us_report", "[ ]*" + time_re + "[ ]+us [ ]*" + time_re + "[ ]+us [ ]*[0-9]+"}, - {"%console_ms_report", "[ ]*" + time_re + "[ ]+ms [ ]*" + time_re + "[ ]+ms [ ]*[0-9]+"}, - {"%console_s_report", "[ ]*" + time_re + "[ ]+s [ ]*" + time_re + "[ ]+s [ ]*[0-9]+"}, - {"%console_time_only_report", "[ ]*" + time_re + "[ ]+ns [ ]*" + time_re + "[ ]+ns"}, - {"%console_us_report", "[ ]*" + time_re + "[ ]+us [ ]*" + time_re + "[ ]+us [ ]*[0-9]+"}, - {"%console_us_time_only_report", "[ ]*" + time_re + "[ ]+us [ ]*" + time_re + "[ ]+us"}, + {"%console_us_report", "[ ]*" + time_re + "[ ]+us [ ]*" + time_re + "[ ]+us [ ]*" + time_re + "[ ]+us [ ]*[0-9]+"}, + {"%console_ms_report", "[ ]*" + time_re + "[ ]+ms [ ]*" + time_re + "[ ]+ms [ ]*" + time_re + "[ ]+ms [ ]*[0-9]+"}, + {"%console_s_report", "[ ]*" + time_re + "[ ]+s [ ]*" + time_re + "[ ]+s [ ]*" + time_re + "[ ]+s [ ]*[0-9]+"}, + {"%console_time_only_report", "[ ]*" + time_re + "[ ]+ns [ ]*" + time_re + "[ ]+ns [ ]*" + time_re + "[ ]+ns"}, + {"%console_us_report", "[ ]*" + time_re + "[ ]+us [ ]*" + time_re + "[ ]+us [ ]*" + time_re + "[ ]+us [ ]*[0-9]+"}, + {"%console_us_time_only_report", "[ ]*" + time_re + "[ ]+us [ ]*" + time_re + "[ ]+us [ ]*" + time_re + "[ ]+us"}, {"%csv_header", "name,iterations,real_time,cpu_time,time_unit,bytes_per_second," "items_per_second,label,error_occurred,error_message"}, diff --git a/test/reporter_output_test.cc b/test/reporter_output_test.cc index 7867165d1f..63b2d98079 100644 --- a/test/reporter_output_test.cc +++ b/test/reporter_output_test.cc @@ -11,7 +11,7 @@ // ========================================================================= // ADD_CASES(TC_ConsoleOut, {{"^[-]+$", MR_Next}, - {"^Benchmark %s Time %s CPU %s Iterations$", MR_Next}, + {"^Benchmark %s Time %s Per-Thread Time %s CPU %s Iterations$", MR_Next}, {"^[-]+$", MR_Next}}); static int AddContextCases() { AddCases(TC_ConsoleErr, @@ -417,8 +417,8 @@ void BM_Complexity_O1(benchmark::State& state) { BENCHMARK(BM_Complexity_O1)->Range(1, 1 << 18)->Complexity(benchmark::o1); SET_SUBSTITUTIONS({{"%bigOStr", "[ ]* %float \\([0-9]+\\)"}, {"%RMS", "[ ]*[0-9]+ %"}}); -ADD_CASES(TC_ConsoleOut, {{"^BM_Complexity_O1_BigO %bigOStr %bigOStr[ ]*$"}, - {"^BM_Complexity_O1_RMS %RMS %RMS[ ]*$"}}); +ADD_CASES(TC_ConsoleOut, {{"^BM_Complexity_O1_BigO %bigOStr %bigOStr %bigOStr[ ]*$"}, + {"^BM_Complexity_O1_RMS %RMS %RMS %RMS[ ]*$"}}); // ========================================================================= // // ----------------------- Testing Aggregate Output ------------------------ // @@ -436,7 +436,8 @@ ADD_CASES(TC_ConsoleOut, {"^BM_Repeat/repeats:2 %console_report$"}, {"^BM_Repeat/repeats:2_mean %console_time_only_report [ ]*2$"}, {"^BM_Repeat/repeats:2_median %console_time_only_report [ ]*2$"}, - {"^BM_Repeat/repeats:2_stddev %console_time_only_report [ ]*2$"}}); + {"^BM_Repeat/repeats:2_stddev %console_time_only_report [ ]*2$"}, + {"^BM_Repeat/repeats:2_cv %console_percentage_report[ ]*$"}}); ADD_CASES(TC_JSONOut, {{"\"name\": \"BM_Repeat/repeats:2\",$"}, {"\"family_index\": 15,$", MR_Next}, {"\"per_family_instance_index\": 0,$", MR_Next}, @@ -496,7 +497,8 @@ ADD_CASES(TC_ConsoleOut, {"^BM_Repeat/repeats:3 %console_report$"}, {"^BM_Repeat/repeats:3_mean %console_time_only_report [ ]*3$"}, {"^BM_Repeat/repeats:3_median %console_time_only_report [ ]*3$"}, - {"^BM_Repeat/repeats:3_stddev %console_time_only_report [ ]*3$"}}); + {"^BM_Repeat/repeats:3_stddev %console_time_only_report [ ]*3$"}, + {"^BM_Repeat/repeats:3_cv %console_percentage_report[ ]*$"}}); ADD_CASES(TC_JSONOut, {{"\"name\": \"BM_Repeat/repeats:3\",$"}, {"\"family_index\": 16,$", MR_Next}, {"\"per_family_instance_index\": 0,$", MR_Next}, @@ -566,7 +568,8 @@ ADD_CASES(TC_ConsoleOut, {"^BM_Repeat/repeats:4 %console_report$"}, {"^BM_Repeat/repeats:4_mean %console_time_only_report [ ]*4$"}, {"^BM_Repeat/repeats:4_median %console_time_only_report [ ]*4$"}, - {"^BM_Repeat/repeats:4_stddev %console_time_only_report [ ]*4$"}}); + {"^BM_Repeat/repeats:4_stddev %console_time_only_report [ ]*4$"}, + {"^BM_Repeat/repeats:4_cv %console_percentage_report[ ]*$"}}); ADD_CASES(TC_JSONOut, {{"\"name\": \"BM_Repeat/repeats:4\",$"}, {"\"family_index\": 17,$", MR_Next}, {"\"per_family_instance_index\": 0,$", MR_Next}, @@ -666,7 +669,8 @@ ADD_CASES( {{".*BM_SummaryRepeat/repeats:3 ", MR_Not}, {"^BM_SummaryRepeat/repeats:3_mean %console_time_only_report [ ]*3$"}, {"^BM_SummaryRepeat/repeats:3_median %console_time_only_report [ ]*3$"}, - {"^BM_SummaryRepeat/repeats:3_stddev %console_time_only_report [ ]*3$"}}); + {"^BM_SummaryRepeat/repeats:3_stddev %console_time_only_report [ ]*3$"}, + {"^BM_SummaryRepeat/repeats:3_cv %console_percentage_report[ ]*$"}}); ADD_CASES(TC_JSONOut, {{".*BM_SummaryRepeat/repeats:3 ", MR_Not}, {"\"name\": \"BM_SummaryRepeat/repeats:3_mean\",$"}, @@ -717,7 +721,8 @@ ADD_CASES( {{".*BM_SummaryDisplay/repeats:2 ", MR_Not}, {"^BM_SummaryDisplay/repeats:2_mean %console_time_only_report [ ]*2$"}, {"^BM_SummaryDisplay/repeats:2_median %console_time_only_report [ ]*2$"}, - {"^BM_SummaryDisplay/repeats:2_stddev %console_time_only_report [ ]*2$"}}); + {"^BM_SummaryDisplay/repeats:2_stddev %console_time_only_report [ ]*2$"}, + {"^BM_SummaryDisplay/repeats:2_cv %console_percentage_report[ ]*$"}}); ADD_CASES(TC_JSONOut, {{".*BM_SummaryDisplay/repeats:2 ", MR_Not}, {"\"name\": \"BM_SummaryDisplay/repeats:2_mean\",$"}, @@ -772,7 +777,8 @@ ADD_CASES( {"^BM_RepeatTimeUnit/repeats:3_median %console_us_time_only_report [ " "]*3$"}, {"^BM_RepeatTimeUnit/repeats:3_stddev %console_us_time_only_report [ " - "]*3$"}}); + "]*3$"}, + {"^BM_RepeatTimeUnit/repeats:3_cv %console_percentage_report[ ]*$"}}); ADD_CASES(TC_JSONOut, {{".*BM_RepeatTimeUnit/repeats:3 ", MR_Not}, {"\"name\": \"BM_RepeatTimeUnit/repeats:3_mean\",$"}, @@ -837,19 +843,19 @@ BENCHMARK(BM_UserStats) // check that user-provided stats is calculated, and is after the default-ones // empty string as name is intentional, it would sort before anything else ADD_CASES(TC_ConsoleOut, {{"^BM_UserStats/iterations:5/repeats:3/manual_time [ " - "]* 150 ns %time [ ]*5$"}, + "]*150 ns [ ]*150 ns [ ]*%time [ ]*5$"}, {"^BM_UserStats/iterations:5/repeats:3/manual_time [ " - "]* 150 ns %time [ ]*5$"}, + "]*150 ns [ ]*150 ns %time [ ]*5$"}, {"^BM_UserStats/iterations:5/repeats:3/manual_time [ " - "]* 150 ns %time [ ]*5$"}, + "]*150 ns [ ]*150 ns %time [ ]*5$"}, {"^BM_UserStats/iterations:5/repeats:3/" - "manual_time_mean [ ]* 150 ns %time [ ]*3$"}, + "manual_time_mean [ ]*150 ns [ ]*150 ns %time [ ]*3$"}, {"^BM_UserStats/iterations:5/repeats:3/" - "manual_time_median [ ]* 150 ns %time [ ]*3$"}, + "manual_time_median [ ]*150 ns [ ]*150 ns %time [ ]*3$"}, {"^BM_UserStats/iterations:5/repeats:3/" - "manual_time_stddev [ ]* 0.000 ns %time [ ]*3$"}, - {"^BM_UserStats/iterations:5/repeats:3/manual_time_ " - "[ ]* 150 ns %time [ ]*3$"}}); + "manual_time_stddev [ ]*0.000 ns [ ]*0.000 ns %time [ ]*3$"}, + {"^BM_UserStats/iterations:5/repeats:3/manual_time_cv " + "%console_percentage_report[ ]*$"}}); ADD_CASES( TC_JSONOut, {{"\"name\": \"BM_UserStats/iterations:5/repeats:3/manual_time\",$"}, @@ -971,19 +977,19 @@ BENCHMARK(BM_UserPercentStats) // anything else ADD_CASES(TC_ConsoleOut, {{"^BM_UserPercentStats/iterations:5/repeats:3/manual_time [ " - "]* 150 ns %time [ ]*5$"}, + "]*150 ns [ ]*150 ns [ ]*%time [ ]*5$"}, {"^BM_UserPercentStats/iterations:5/repeats:3/manual_time [ " - "]* 150 ns %time [ ]*5$"}, + "]* 150 ns [ ]*150 ns [ ]*%time [ ]*5$"}, {"^BM_UserPercentStats/iterations:5/repeats:3/manual_time [ " - "]* 150 ns %time [ ]*5$"}, + "]* 150 ns [ ]*150 ns [ ]*%time [ ]*5$"}, {"^BM_UserPercentStats/iterations:5/repeats:3/" - "manual_time_mean [ ]* 150 ns %time [ ]*3$"}, + "manual_time_mean [ ]* 150 ns [ ]*150 ns [ ]*%time [ ]*3$"}, {"^BM_UserPercentStats/iterations:5/repeats:3/" - "manual_time_median [ ]* 150 ns %time [ ]*3$"}, + "manual_time_median [ ]* 150 ns [ ]*150 ns [ ]*%time [ ]*3$"}, {"^BM_UserPercentStats/iterations:5/repeats:3/" - "manual_time_stddev [ ]* 0.000 ns %time [ ]*3$"}, - {"^BM_UserPercentStats/iterations:5/repeats:3/manual_time_ " - "[ ]* 1.00 % [ ]* 1.00 %[ ]*3$"}}); + "manual_time_stddev [ ]* 0.000 ns [ ]*0.000 ns [ ]*%time [ ]*3$"}, + {"^BM_UserPercentStats/iterations:5/repeats:3/manual_time_cv " + "%console_percentage_report[ ]*$"}}); ADD_CASES( TC_JSONOut, {{"\"name\": \"BM_UserPercentStats/iterations:5/repeats:3/manual_time\",$"}, diff --git a/test/user_counters_tabular_test.cc b/test/user_counters_tabular_test.cc index cfc1ab069c..dcfe778bfd 100644 --- a/test/user_counters_tabular_test.cc +++ b/test/user_counters_tabular_test.cc @@ -12,7 +12,7 @@ ADD_CASES(TC_ConsoleOut, // keeping these lines long improves readability, so: // clang-format off {"^[-]+$", MR_Next}, - {"^Benchmark %s Time %s CPU %s Iterations %s Bar %s Bat %s Baz %s Foo %s Frob %s Lob$", MR_Next}, + {"^Benchmark %s Time %s Per-Thread Time %s CPU %s Iterations %s Bar %s Bat %s Baz %s Foo %s Frob %s Lob$", MR_Next}, {"^[-]+$", MR_Next}, {"^BM_Counters_Tabular/repeats:2/threads:1 %console_report [ ]*%hrfloat [ ]*%hrfloat [ ]*%hrfloat [ ]*%hrfloat [ ]*%hrfloat [ ]*%hrfloat$", MR_Next}, {"^BM_Counters_Tabular/repeats:2/threads:1 %console_report [ ]*%hrfloat [ ]*%hrfloat [ ]*%hrfloat [ ]*%hrfloat [ ]*%hrfloat [ ]*%hrfloat$", MR_Next}, @@ -32,7 +32,7 @@ ADD_CASES(TC_ConsoleOut, {"^BM_CounterRates_Tabular/threads:%int %console_report [ ]*%hrfloat/s [ ]*%hrfloat/s [ ]*%hrfloat/s [ ]*%hrfloat/s [ ]*%hrfloat/s [ ]*%hrfloat/s$", MR_Next}, {"^BM_CounterRates_Tabular/threads:%int %console_report [ ]*%hrfloat/s [ ]*%hrfloat/s [ ]*%hrfloat/s [ ]*%hrfloat/s [ ]*%hrfloat/s [ ]*%hrfloat/s$", MR_Next}, {"^[-]+$", MR_Next}, - {"^Benchmark %s Time %s CPU %s Iterations %s Bar %s Baz %s Foo$", MR_Next}, + {"^Benchmark %s Time %s Per-Thread Time %s CPU %s Iterations %s Bar %s Baz %s Foo$", MR_Next}, {"^[-]+$", MR_Next}, {"^BM_CounterSet0_Tabular/threads:%int %console_report [ ]*%hrfloat [ ]*%hrfloat [ ]*%hrfloat$", MR_Next}, {"^BM_CounterSet0_Tabular/threads:%int %console_report [ ]*%hrfloat [ ]*%hrfloat [ ]*%hrfloat$", MR_Next}, @@ -45,12 +45,12 @@ ADD_CASES(TC_ConsoleOut, {"^BM_CounterSet1_Tabular/threads:%int %console_report [ ]*%hrfloat [ ]*%hrfloat [ ]*%hrfloat$", MR_Next}, {"^BM_CounterSet1_Tabular/threads:%int %console_report [ ]*%hrfloat [ ]*%hrfloat [ ]*%hrfloat$", MR_Next}, {"^[-]+$", MR_Next}, - {"^Benchmark %s Time %s CPU %s Iterations %s Bat %s Baz %s Foo$", MR_Next}, + {"^Benchmark %s Time %s Per-Thread Time %s CPU %s Iterations %s Bat %s Baz %s Foo$", MR_Next}, {"^[-]+$", MR_Next}, {"^BM_CounterSet2_Tabular/threads:%int %console_report [ ]*%hrfloat [ ]*%hrfloat [ ]*%hrfloat$", MR_Next}, {"^BM_CounterSet2_Tabular/threads:%int %console_report [ ]*%hrfloat [ ]*%hrfloat [ ]*%hrfloat$", MR_Next}, {"^BM_CounterSet2_Tabular/threads:%int %console_report [ ]*%hrfloat [ ]*%hrfloat [ ]*%hrfloat$", MR_Next}, - {"^BM_CounterSet2_Tabular/threads:%int %console_report [ ]*%hrfloat [ ]*%hrfloat [ ]*%hrfloat$", MR_Next}, + //{"^BM_CounterSet2_Tabular/threads:%int %console_report [ ]*%hrfloat [ ]*%hrfloat [ ]*%hrfloat$", MR_Next}, {"^BM_CounterSet2_Tabular/threads:%int %console_report [ ]*%hrfloat [ ]*%hrfloat [ ]*%hrfloat$"}, // clang-format on }); @@ -221,6 +221,7 @@ ADD_CASES(TC_JSONOut, {"\"threads\": 2,$", MR_Next}, {"\"iterations\": %int,$", MR_Next}, {"\"real_time\": %float,$", MR_Next}, + {"\"per_thread_real_time\": %float,$", MR_Next}, {"\"cpu_time\": %float,$", MR_Next}, {"\"time_unit\": \"ns\",$", MR_Next}, {"\"Bar\": %float,$", MR_Next}, @@ -242,6 +243,7 @@ ADD_CASES(TC_JSONOut, {"\"threads\": 2,$", MR_Next}, {"\"iterations\": %int,$", MR_Next}, {"\"real_time\": %float,$", MR_Next}, + {"\"per_thread_real_time\": %float,$", MR_Next}, {"\"cpu_time\": %float,$", MR_Next}, {"\"time_unit\": \"ns\",$", MR_Next}, {"\"Bar\": %float,$", MR_Next}, @@ -264,6 +266,7 @@ ADD_CASES(TC_JSONOut, {"\"aggregate_unit\": \"time\",$", MR_Next}, {"\"iterations\": %int,$", MR_Next}, {"\"real_time\": %float,$", MR_Next}, + {"\"per_thread_real_time\": %float,$", MR_Next}, {"\"cpu_time\": %float,$", MR_Next}, {"\"time_unit\": \"ns\",$", MR_Next}, {"\"Bar\": %float,$", MR_Next}, @@ -286,6 +289,7 @@ ADD_CASES(TC_JSONOut, {"\"aggregate_unit\": \"time\",$", MR_Next}, {"\"iterations\": %int,$", MR_Next}, {"\"real_time\": %float,$", MR_Next}, + {"\"per_thread_real_time\": %float,$", MR_Next}, {"\"cpu_time\": %float,$", MR_Next}, {"\"time_unit\": \"ns\",$", MR_Next}, {"\"Bar\": %float,$", MR_Next}, @@ -308,6 +312,7 @@ ADD_CASES(TC_JSONOut, {"\"aggregate_unit\": \"percentage\",$", MR_Next}, {"\"iterations\": %int,$", MR_Next}, {"\"real_time\": %float,$", MR_Next}, + {"\"per_thread_real_time\": %float,$", MR_Next}, {"\"cpu_time\": %float,$", MR_Next}, {"\"time_unit\": \"ns\",$", MR_Next}, {"\"Bar\": %float,$", MR_Next}, @@ -481,9 +486,10 @@ void BM_CounterSet1_Tabular(benchmark::State& state) { {"Baz", {45, bm::Counter::kAvgThreads}}, }); } -BENCHMARK(BM_CounterSet1_Tabular)->ThreadRange(1, 16); +BENCHMARK(BM_CounterSet1_Tabular)->Threads(1); +BENCHMARK(BM_CounterSet1_Tabular)->ThreadRange(2, 16); ADD_CASES(TC_JSONOut, - {{"\"name\": \"BM_CounterSet1_Tabular/threads:%int\",$"}, + {{"\"name\": \"BM_CounterSet1_Tabular/threads:1\",$"}, {"\"family_index\": 3,$", MR_Next}, {"\"per_family_instance_index\": 0,$", MR_Next}, {"\"run_name\": \"BM_CounterSet1_Tabular/threads:%int\",$", MR_Next}, @@ -499,6 +505,24 @@ ADD_CASES(TC_JSONOut, {"\"Baz\": %float,$", MR_Next}, {"\"Foo\": %float$", MR_Next}, {"}", MR_Next}}); +ADD_CASES(TC_JSONOut, + {{"\"name\": \"BM_CounterSet1_Tabular/threads:%int\",$"}, + {"\"family_index\": 4,$", MR_Next}, + {"\"per_family_instance_index\": 0,$", MR_Next}, + {"\"run_name\": \"BM_CounterSet1_Tabular/threads:%int\",$", MR_Next}, + {"\"run_type\": \"iteration\",$", MR_Next}, + {"\"repetitions\": 1,$", MR_Next}, + {"\"repetition_index\": 0,$", MR_Next}, + {"\"threads\": 2,$", MR_Next}, + {"\"iterations\": %int,$", MR_Next}, + {"\"real_time\": %float,$", MR_Next}, + {"\"per_thread_real_time\": %float,$", MR_Next}, + {"\"cpu_time\": %float,$", MR_Next}, + {"\"time_unit\": \"ns\",$", MR_Next}, + {"\"Bar\": %float,$", MR_Next}, + {"\"Baz\": %float,$", MR_Next}, + {"\"Foo\": %float$", MR_Next}, + {"}", MR_Next}}); ADD_CASES(TC_CSVOut, {{"^\"BM_CounterSet1_Tabular/threads:%int\",%csv_report," "%float,,%float,%float,,"}}); // VS2013 does not allow this function to be passed as a lambda argument @@ -525,18 +549,19 @@ void BM_CounterSet2_Tabular(benchmark::State& state) { {"Baz", {40, bm::Counter::kAvgThreads}}, }); } -BENCHMARK(BM_CounterSet2_Tabular)->ThreadRange(1, 16); +BENCHMARK(BM_CounterSet2_Tabular)->ThreadRange(2, 16); ADD_CASES(TC_JSONOut, {{"\"name\": \"BM_CounterSet2_Tabular/threads:%int\",$"}, - {"\"family_index\": 4,$", MR_Next}, + {"\"family_index\": 5,$", MR_Next}, {"\"per_family_instance_index\": 0,$", MR_Next}, {"\"run_name\": \"BM_CounterSet2_Tabular/threads:%int\",$", MR_Next}, {"\"run_type\": \"iteration\",$", MR_Next}, {"\"repetitions\": 1,$", MR_Next}, {"\"repetition_index\": 0,$", MR_Next}, - {"\"threads\": 1,$", MR_Next}, + {"\"threads\": 2,$", MR_Next}, {"\"iterations\": %int,$", MR_Next}, {"\"real_time\": %float,$", MR_Next}, + {"\"per_thread_real_time\": %float,$", MR_Next}, {"\"cpu_time\": %float,$", MR_Next}, {"\"time_unit\": \"ns\",$", MR_Next}, {"\"Bat\": %float,$", MR_Next}, diff --git a/test/user_counters_test.cc b/test/user_counters_test.cc index 22252acbf6..73ec217373 100644 --- a/test/user_counters_test.cc +++ b/test/user_counters_test.cc @@ -12,7 +12,7 @@ ADD_CASES(TC_ConsoleOut, {{"^[-]+$", MR_Next}, - {"^Benchmark %s Time %s CPU %s Iterations UserCounters...$", MR_Next}, + {"^Benchmark %s Time %s Per-Thread Time %s CPU %s Iterations UserCounters...$", MR_Next}, {"^[-]+$", MR_Next}}); ADD_CASES(TC_CSVOut, {{"%csv_header,\"bar\",\"foo\""}}); From a1c840fd5d41bf0e02336f6438179809612853f7 Mon Sep 17 00:00:00 2001 From: Dominic Hamon Date: Wed, 7 Aug 2024 16:47:41 +0100 Subject: [PATCH 2/7] clang-format --- src/json_reporter.cc | 10 ++++----- test/output_test_helper.cc | 13 ++++++----- test/reporter_output_test.cc | 42 ++++++++++++++++++++---------------- 3 files changed, 34 insertions(+), 31 deletions(-) diff --git a/src/json_reporter.cc b/src/json_reporter.cc index b65a2ca798..985ebb63dd 100644 --- a/src/json_reporter.cc +++ b/src/json_reporter.cc @@ -287,11 +287,11 @@ void JSONReporter::PrintRunData(Run const& run) { out << indent << FormatKV("real_time", run.real_accumulated_time) << ",\n"; if (run.threads != 1) { - out << indent - << FormatKV( - "per_thread_real_time", - run.real_accumulated_time * static_cast(run.threads)) - << ",\n"; + out << indent + << FormatKV( + "per_thread_real_time", + run.real_accumulated_time * static_cast(run.threads)) + << ",\n"; } out << indent << FormatKV("cpu_time", run.cpu_accumulated_time); } diff --git a/test/output_test_helper.cc b/test/output_test_helper.cc index cc61bb9c3c..4fcd0d8f31 100644 --- a/test/output_test_helper.cc +++ b/test/output_test_helper.cc @@ -108,21 +108,20 @@ void CheckCase(std::stringstream& remaining_output, TestCase const& TC, for (const auto& NC : not_checks) { BM_CHECK(!NC.regex->Match(line)) << "Unexpected match for line \"" << line << "\" for MR_Not regex \"" - << NC.regex_str << "\"" - << "\n actual regex string \"" << TC.substituted_regex << "\"" + << NC.regex_str << "\"" << "\n actual regex string \"" + << TC.substituted_regex << "\"" << "\n started matching near: " << first_line; } if (TC.regex->Match(line)) return; BM_CHECK(TC.match_rule != MR_Next) << "Expected line \"" << line << "\" to match regex \"" << TC.regex_str - << "\"" - << "\n actual regex string \"" << TC.substituted_regex << "\"" - << "\n started matching near: " << first_line; + << "\"" << "\n actual regex string \"" << TC.substituted_regex + << "\"" << "\n started matching near: " << first_line; } BM_CHECK(remaining_output.eof() == false) << "End of output reached before match for regex \"" << TC.regex_str - << "\" was found" - << "\n actual regex string \"" << TC.substituted_regex << "\"" + << "\" was found" << "\n actual regex string \"" + << TC.substituted_regex << "\"" << "\n started matching near: " << first_line; } diff --git a/test/reporter_output_test.cc b/test/reporter_output_test.cc index 63b2d98079..00999f73e8 100644 --- a/test/reporter_output_test.cc +++ b/test/reporter_output_test.cc @@ -10,9 +10,11 @@ // ---------------------- Testing Prologue Output -------------------------- // // ========================================================================= // -ADD_CASES(TC_ConsoleOut, {{"^[-]+$", MR_Next}, - {"^Benchmark %s Time %s Per-Thread Time %s CPU %s Iterations$", MR_Next}, - {"^[-]+$", MR_Next}}); +ADD_CASES(TC_ConsoleOut, + {{"^[-]+$", MR_Next}, + {"^Benchmark %s Time %s Per-Thread Time %s CPU %s Iterations$", + MR_Next}, + {"^[-]+$", MR_Next}}); static int AddContextCases() { AddCases(TC_ConsoleErr, { @@ -417,8 +419,9 @@ void BM_Complexity_O1(benchmark::State& state) { BENCHMARK(BM_Complexity_O1)->Range(1, 1 << 18)->Complexity(benchmark::o1); SET_SUBSTITUTIONS({{"%bigOStr", "[ ]* %float \\([0-9]+\\)"}, {"%RMS", "[ ]*[0-9]+ %"}}); -ADD_CASES(TC_ConsoleOut, {{"^BM_Complexity_O1_BigO %bigOStr %bigOStr %bigOStr[ ]*$"}, - {"^BM_Complexity_O1_RMS %RMS %RMS %RMS[ ]*$"}}); +ADD_CASES(TC_ConsoleOut, + {{"^BM_Complexity_O1_BigO %bigOStr %bigOStr %bigOStr[ ]*$"}, + {"^BM_Complexity_O1_RMS %RMS %RMS %RMS[ ]*$"}}); // ========================================================================= // // ----------------------- Testing Aggregate Output ------------------------ // @@ -842,20 +845,21 @@ BENCHMARK(BM_UserStats) // check that user-provided stats is calculated, and is after the default-ones // empty string as name is intentional, it would sort before anything else -ADD_CASES(TC_ConsoleOut, {{"^BM_UserStats/iterations:5/repeats:3/manual_time [ " - "]*150 ns [ ]*150 ns [ ]*%time [ ]*5$"}, - {"^BM_UserStats/iterations:5/repeats:3/manual_time [ " - "]*150 ns [ ]*150 ns %time [ ]*5$"}, - {"^BM_UserStats/iterations:5/repeats:3/manual_time [ " - "]*150 ns [ ]*150 ns %time [ ]*5$"}, - {"^BM_UserStats/iterations:5/repeats:3/" - "manual_time_mean [ ]*150 ns [ ]*150 ns %time [ ]*3$"}, - {"^BM_UserStats/iterations:5/repeats:3/" - "manual_time_median [ ]*150 ns [ ]*150 ns %time [ ]*3$"}, - {"^BM_UserStats/iterations:5/repeats:3/" - "manual_time_stddev [ ]*0.000 ns [ ]*0.000 ns %time [ ]*3$"}, - {"^BM_UserStats/iterations:5/repeats:3/manual_time_cv " - "%console_percentage_report[ ]*$"}}); +ADD_CASES(TC_ConsoleOut, + {{"^BM_UserStats/iterations:5/repeats:3/manual_time [ " + "]*150 ns [ ]*150 ns [ ]*%time [ ]*5$"}, + {"^BM_UserStats/iterations:5/repeats:3/manual_time [ " + "]*150 ns [ ]*150 ns %time [ ]*5$"}, + {"^BM_UserStats/iterations:5/repeats:3/manual_time [ " + "]*150 ns [ ]*150 ns %time [ ]*5$"}, + {"^BM_UserStats/iterations:5/repeats:3/" + "manual_time_mean [ ]*150 ns [ ]*150 ns %time [ ]*3$"}, + {"^BM_UserStats/iterations:5/repeats:3/" + "manual_time_median [ ]*150 ns [ ]*150 ns %time [ ]*3$"}, + {"^BM_UserStats/iterations:5/repeats:3/" + "manual_time_stddev [ ]*0.000 ns [ ]*0.000 ns %time [ ]*3$"}, + {"^BM_UserStats/iterations:5/repeats:3/manual_time_cv " + "%console_percentage_report[ ]*$"}}); ADD_CASES( TC_JSONOut, {{"\"name\": \"BM_UserStats/iterations:5/repeats:3/manual_time\",$"}, From 0d52a112cd1df23cf6eec0974905b2d80bd05c5d Mon Sep 17 00:00:00 2001 From: Dominic Hamon Date: Wed, 7 Aug 2024 16:54:33 +0100 Subject: [PATCH 3/7] more clang-format --- test/output_test_helper.cc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/test/output_test_helper.cc b/test/output_test_helper.cc index 4fcd0d8f31..cc61bb9c3c 100644 --- a/test/output_test_helper.cc +++ b/test/output_test_helper.cc @@ -108,20 +108,21 @@ void CheckCase(std::stringstream& remaining_output, TestCase const& TC, for (const auto& NC : not_checks) { BM_CHECK(!NC.regex->Match(line)) << "Unexpected match for line \"" << line << "\" for MR_Not regex \"" - << NC.regex_str << "\"" << "\n actual regex string \"" - << TC.substituted_regex << "\"" + << NC.regex_str << "\"" + << "\n actual regex string \"" << TC.substituted_regex << "\"" << "\n started matching near: " << first_line; } if (TC.regex->Match(line)) return; BM_CHECK(TC.match_rule != MR_Next) << "Expected line \"" << line << "\" to match regex \"" << TC.regex_str - << "\"" << "\n actual regex string \"" << TC.substituted_regex - << "\"" << "\n started matching near: " << first_line; + << "\"" + << "\n actual regex string \"" << TC.substituted_regex << "\"" + << "\n started matching near: " << first_line; } BM_CHECK(remaining_output.eof() == false) << "End of output reached before match for regex \"" << TC.regex_str - << "\" was found" << "\n actual regex string \"" - << TC.substituted_regex << "\"" + << "\" was found" + << "\n actual regex string \"" << TC.substituted_regex << "\"" << "\n started matching near: " << first_line; } From 9a2d2462f1e1f01698bc5f7b866e4c4f221d7769 Mon Sep 17 00:00:00 2001 From: Dominic Hamon Date: Fri, 9 Aug 2024 16:17:47 +0100 Subject: [PATCH 4/7] change the default to not scale --- src/benchmark_runner.cc | 7 +-- src/console_reporter.cc | 27 +++++------ src/json_reporter.cc | 14 ------ test/complexity_test.cc | 4 +- test/output_test_helper.cc | 14 +++--- test/reporter_output_test.cc | 76 +++++++++++++----------------- test/user_counters_tabular_test.cc | 43 ++++------------- test/user_counters_test.cc | 2 +- 8 files changed, 65 insertions(+), 122 deletions(-) diff --git a/src/benchmark_runner.cc b/src/benchmark_runner.cc index 19f468af94..20f9bda056 100644 --- a/src/benchmark_runner.cc +++ b/src/benchmark_runner.cc @@ -292,11 +292,8 @@ BenchmarkRunner::IterationResults BenchmarkRunner::DoNIterations() { // And get rid of the manager. manager.reset(); - // Adjust real/manual time stats since they were reported per thread. - i.results.real_time_used /= b.threads(); - i.results.manual_time_used /= b.threads(); - // If we were measuring whole-process CPU usage, adjust the CPU time too. - if (b.measure_process_cpu_time()) i.results.cpu_time_used /= b.threads(); + i.results.real_time_used; + i.results.manual_time_used; BM_VLOG(2) << "Ran in " << i.results.cpu_time_used << "/" << i.results.real_time_used << "\n"; diff --git a/src/console_reporter.cc b/src/console_reporter.cc index 10edacff98..28272d8e3c 100644 --- a/src/console_reporter.cc +++ b/src/console_reporter.cc @@ -60,8 +60,8 @@ bool ConsoleReporter::ReportContext(const Context& context) { BENCHMARK_EXPORT void ConsoleReporter::PrintHeader(const Run& run) { std::string str = FormatString( - "%-*s %13s %15s %15s %12s", static_cast(name_field_width_), - "Benchmark", "Time", "Per-Thread Time", "CPU", "Iterations"); + "%-*s %13s %15s %12s", static_cast(name_field_width_), + "Benchmark", "Time", "CPU", "Iterations"); if (!run.counters.empty()) { if (output_options_ & OO_Tabular) { for (auto const& c : run.counters) { @@ -151,32 +151,27 @@ void ConsoleReporter::PrintRunData(const Run& result) { } const double real_time = result.GetAdjustedRealTime(); - const double per_thread_real_time = - real_time * static_cast(result.threads); const double cpu_time = result.GetAdjustedCPUTime(); const std::string real_time_str = FormatTime(real_time); - const std::string per_thread_real_time_str = FormatTime(per_thread_real_time); const std::string cpu_time_str = FormatTime(cpu_time); if (result.report_big_o) { std::string big_o = GetBigOString(result.complexity); - printer(Out, COLOR_YELLOW, "%10.2f %-4s %10.2f %-4s %10.2f %-4s ", - real_time, big_o.c_str(), per_thread_real_time, big_o.c_str(), - cpu_time, big_o.c_str()); + printer(Out, COLOR_YELLOW, "%10.2f %-4s %10.2f %-4s ", + real_time, big_o.c_str(), cpu_time, big_o.c_str()); } else if (result.report_rms) { - printer(Out, COLOR_YELLOW, "%10.0f %-4s %10.0f %-4s %10.0f %-4s ", - real_time * 100, "%", per_thread_real_time * 100, "%", - cpu_time * 100, "%"); + printer(Out, COLOR_YELLOW, "%10.0f %-4s %10.0f %-4s ", + real_time * 100, "%", "%", cpu_time * 100, "%"); } else if (result.run_type != Run::RT_Aggregate || result.aggregate_unit == StatisticUnit::kTime) { const char* timeLabel = GetTimeUnitString(result.time_unit); - printer(Out, COLOR_YELLOW, "%s %-4s %s %-4s %s %-4s ", - real_time_str.c_str(), timeLabel, per_thread_real_time_str.c_str(), - timeLabel, cpu_time_str.c_str(), timeLabel); + printer(Out, COLOR_YELLOW, "%s %-4s %s %-4s ", + real_time_str.c_str(), timeLabel, + cpu_time_str.c_str(), timeLabel); } else { assert(result.aggregate_unit == StatisticUnit::kPercentage); - printer(Out, COLOR_YELLOW, "%10.2f %-4s %10s %-4s %10.2f %-4s ", - (100. * result.real_accumulated_time), "%", " ", " ", + printer(Out, COLOR_YELLOW, "%10.2f %-4s %10.2f %-4s ", + (100. * result.real_accumulated_time), "%", (100. * result.cpu_accumulated_time), "%"); } diff --git a/src/json_reporter.cc b/src/json_reporter.cc index 985ebb63dd..b8c8c94c08 100644 --- a/src/json_reporter.cc +++ b/src/json_reporter.cc @@ -274,25 +274,11 @@ void JSONReporter::PrintRunData(Run const& run) { run.aggregate_unit == StatisticUnit::kTime) { out << indent << FormatKV("real_time", run.GetAdjustedRealTime()) << ",\n"; - if (run.threads != 1) { - out << indent - << FormatKV( - "per_thread_real_time", - run.GetAdjustedRealTime() * static_cast(run.threads)) - << ",\n"; - } out << indent << FormatKV("cpu_time", run.GetAdjustedCPUTime()); } else { assert(run.aggregate_unit == StatisticUnit::kPercentage); out << indent << FormatKV("real_time", run.real_accumulated_time) << ",\n"; - if (run.threads != 1) { - out << indent - << FormatKV( - "per_thread_real_time", - run.real_accumulated_time * static_cast(run.threads)) - << ",\n"; - } out << indent << FormatKV("cpu_time", run.cpu_accumulated_time); } out << ",\n" diff --git a/test/complexity_test.cc b/test/complexity_test.cc index 268cffedcf..0729d15aa7 100644 --- a/test/complexity_test.cc +++ b/test/complexity_test.cc @@ -25,9 +25,9 @@ int AddComplexityTest(const std::string &test_name, {"%rms", "[ ]*[0-9]+ %"}}); AddCases( TC_ConsoleOut, - {{"^%bigo_name %bigo_str %bigo_str %bigo_str[ ]*$"}, + {{"^%bigo_name %bigo_str %bigo_str[ ]*$"}, {"^%bigo_name", MR_Not}, // Assert we we didn't only matched a name. - {"^%rms_name %rms %rms %rms[ ]*$", MR_Next}}); + {"^%rms_name %rms %rms[ ]*$", MR_Next}}); AddCases( TC_JSONOut, {{"\"name\": \"%bigo_name\",$"}, diff --git a/test/output_test_helper.cc b/test/output_test_helper.cc index cc61bb9c3c..265f28aae7 100644 --- a/test/output_test_helper.cc +++ b/test/output_test_helper.cc @@ -50,14 +50,14 @@ SubMap& GetSubstitutions() { {"%int", "[ ]*[0-9]+"}, {" %s ", "[ ]+"}, {"%time", "[ ]*" + time_re + "[ ]+ns"}, - {"%console_report", "[ ]*" + time_re + "[ ]+ns [ ]*" + time_re + "[ ]+ns [ ]*" + time_re + "[ ]+ns [ ]*[0-9]+"}, + {"%console_report", "[ ]*" + time_re + "[ ]+ns [ ]*" + time_re + "[ ]+ns [ ]*[0-9]+"}, {"%console_percentage_report", "[ ]*" + percentage_re + "[ ]+% [ ]*" + percentage_re + "[ ]+% [ ]*[0-9]+"}, - {"%console_us_report", "[ ]*" + time_re + "[ ]+us [ ]*" + time_re + "[ ]+us [ ]*" + time_re + "[ ]+us [ ]*[0-9]+"}, - {"%console_ms_report", "[ ]*" + time_re + "[ ]+ms [ ]*" + time_re + "[ ]+ms [ ]*" + time_re + "[ ]+ms [ ]*[0-9]+"}, - {"%console_s_report", "[ ]*" + time_re + "[ ]+s [ ]*" + time_re + "[ ]+s [ ]*" + time_re + "[ ]+s [ ]*[0-9]+"}, - {"%console_time_only_report", "[ ]*" + time_re + "[ ]+ns [ ]*" + time_re + "[ ]+ns [ ]*" + time_re + "[ ]+ns"}, - {"%console_us_report", "[ ]*" + time_re + "[ ]+us [ ]*" + time_re + "[ ]+us [ ]*" + time_re + "[ ]+us [ ]*[0-9]+"}, - {"%console_us_time_only_report", "[ ]*" + time_re + "[ ]+us [ ]*" + time_re + "[ ]+us [ ]*" + time_re + "[ ]+us"}, + {"%console_us_report", "[ ]*" + time_re + "[ ]+us [ ]*" + time_re + "[ ]+us [ ]*[0-9]+"}, + {"%console_ms_report", "[ ]*" + time_re + "[ ]+ms [ ]*" + time_re + "[ ]+ms [ ]*[0-9]+"}, + {"%console_s_report", "[ ]*" + time_re + "[ ]+s [ ]*" + time_re + "[ ]+s [ ]*[0-9]+"}, + {"%console_time_only_report", "[ ]*" + time_re + "[ ]+ns [ ]*" + time_re + "[ ]+ns"}, + {"%console_us_report", "[ ]*" + time_re + "[ ]+us [ ]*" + time_re + "[ ]+us [ ]*[0-9]+"}, + {"%console_us_time_only_report", "[ ]*" + time_re + "[ ]+us [ ]*" + time_re + "[ ]+us"}, {"%csv_header", "name,iterations,real_time,cpu_time,time_unit,bytes_per_second," "items_per_second,label,error_occurred,error_message"}, diff --git a/test/reporter_output_test.cc b/test/reporter_output_test.cc index 00999f73e8..7867165d1f 100644 --- a/test/reporter_output_test.cc +++ b/test/reporter_output_test.cc @@ -10,11 +10,9 @@ // ---------------------- Testing Prologue Output -------------------------- // // ========================================================================= // -ADD_CASES(TC_ConsoleOut, - {{"^[-]+$", MR_Next}, - {"^Benchmark %s Time %s Per-Thread Time %s CPU %s Iterations$", - MR_Next}, - {"^[-]+$", MR_Next}}); +ADD_CASES(TC_ConsoleOut, {{"^[-]+$", MR_Next}, + {"^Benchmark %s Time %s CPU %s Iterations$", MR_Next}, + {"^[-]+$", MR_Next}}); static int AddContextCases() { AddCases(TC_ConsoleErr, { @@ -419,9 +417,8 @@ void BM_Complexity_O1(benchmark::State& state) { BENCHMARK(BM_Complexity_O1)->Range(1, 1 << 18)->Complexity(benchmark::o1); SET_SUBSTITUTIONS({{"%bigOStr", "[ ]* %float \\([0-9]+\\)"}, {"%RMS", "[ ]*[0-9]+ %"}}); -ADD_CASES(TC_ConsoleOut, - {{"^BM_Complexity_O1_BigO %bigOStr %bigOStr %bigOStr[ ]*$"}, - {"^BM_Complexity_O1_RMS %RMS %RMS %RMS[ ]*$"}}); +ADD_CASES(TC_ConsoleOut, {{"^BM_Complexity_O1_BigO %bigOStr %bigOStr[ ]*$"}, + {"^BM_Complexity_O1_RMS %RMS %RMS[ ]*$"}}); // ========================================================================= // // ----------------------- Testing Aggregate Output ------------------------ // @@ -439,8 +436,7 @@ ADD_CASES(TC_ConsoleOut, {"^BM_Repeat/repeats:2 %console_report$"}, {"^BM_Repeat/repeats:2_mean %console_time_only_report [ ]*2$"}, {"^BM_Repeat/repeats:2_median %console_time_only_report [ ]*2$"}, - {"^BM_Repeat/repeats:2_stddev %console_time_only_report [ ]*2$"}, - {"^BM_Repeat/repeats:2_cv %console_percentage_report[ ]*$"}}); + {"^BM_Repeat/repeats:2_stddev %console_time_only_report [ ]*2$"}}); ADD_CASES(TC_JSONOut, {{"\"name\": \"BM_Repeat/repeats:2\",$"}, {"\"family_index\": 15,$", MR_Next}, {"\"per_family_instance_index\": 0,$", MR_Next}, @@ -500,8 +496,7 @@ ADD_CASES(TC_ConsoleOut, {"^BM_Repeat/repeats:3 %console_report$"}, {"^BM_Repeat/repeats:3_mean %console_time_only_report [ ]*3$"}, {"^BM_Repeat/repeats:3_median %console_time_only_report [ ]*3$"}, - {"^BM_Repeat/repeats:3_stddev %console_time_only_report [ ]*3$"}, - {"^BM_Repeat/repeats:3_cv %console_percentage_report[ ]*$"}}); + {"^BM_Repeat/repeats:3_stddev %console_time_only_report [ ]*3$"}}); ADD_CASES(TC_JSONOut, {{"\"name\": \"BM_Repeat/repeats:3\",$"}, {"\"family_index\": 16,$", MR_Next}, {"\"per_family_instance_index\": 0,$", MR_Next}, @@ -571,8 +566,7 @@ ADD_CASES(TC_ConsoleOut, {"^BM_Repeat/repeats:4 %console_report$"}, {"^BM_Repeat/repeats:4_mean %console_time_only_report [ ]*4$"}, {"^BM_Repeat/repeats:4_median %console_time_only_report [ ]*4$"}, - {"^BM_Repeat/repeats:4_stddev %console_time_only_report [ ]*4$"}, - {"^BM_Repeat/repeats:4_cv %console_percentage_report[ ]*$"}}); + {"^BM_Repeat/repeats:4_stddev %console_time_only_report [ ]*4$"}}); ADD_CASES(TC_JSONOut, {{"\"name\": \"BM_Repeat/repeats:4\",$"}, {"\"family_index\": 17,$", MR_Next}, {"\"per_family_instance_index\": 0,$", MR_Next}, @@ -672,8 +666,7 @@ ADD_CASES( {{".*BM_SummaryRepeat/repeats:3 ", MR_Not}, {"^BM_SummaryRepeat/repeats:3_mean %console_time_only_report [ ]*3$"}, {"^BM_SummaryRepeat/repeats:3_median %console_time_only_report [ ]*3$"}, - {"^BM_SummaryRepeat/repeats:3_stddev %console_time_only_report [ ]*3$"}, - {"^BM_SummaryRepeat/repeats:3_cv %console_percentage_report[ ]*$"}}); + {"^BM_SummaryRepeat/repeats:3_stddev %console_time_only_report [ ]*3$"}}); ADD_CASES(TC_JSONOut, {{".*BM_SummaryRepeat/repeats:3 ", MR_Not}, {"\"name\": \"BM_SummaryRepeat/repeats:3_mean\",$"}, @@ -724,8 +717,7 @@ ADD_CASES( {{".*BM_SummaryDisplay/repeats:2 ", MR_Not}, {"^BM_SummaryDisplay/repeats:2_mean %console_time_only_report [ ]*2$"}, {"^BM_SummaryDisplay/repeats:2_median %console_time_only_report [ ]*2$"}, - {"^BM_SummaryDisplay/repeats:2_stddev %console_time_only_report [ ]*2$"}, - {"^BM_SummaryDisplay/repeats:2_cv %console_percentage_report[ ]*$"}}); + {"^BM_SummaryDisplay/repeats:2_stddev %console_time_only_report [ ]*2$"}}); ADD_CASES(TC_JSONOut, {{".*BM_SummaryDisplay/repeats:2 ", MR_Not}, {"\"name\": \"BM_SummaryDisplay/repeats:2_mean\",$"}, @@ -780,8 +772,7 @@ ADD_CASES( {"^BM_RepeatTimeUnit/repeats:3_median %console_us_time_only_report [ " "]*3$"}, {"^BM_RepeatTimeUnit/repeats:3_stddev %console_us_time_only_report [ " - "]*3$"}, - {"^BM_RepeatTimeUnit/repeats:3_cv %console_percentage_report[ ]*$"}}); + "]*3$"}}); ADD_CASES(TC_JSONOut, {{".*BM_RepeatTimeUnit/repeats:3 ", MR_Not}, {"\"name\": \"BM_RepeatTimeUnit/repeats:3_mean\",$"}, @@ -845,21 +836,20 @@ BENCHMARK(BM_UserStats) // check that user-provided stats is calculated, and is after the default-ones // empty string as name is intentional, it would sort before anything else -ADD_CASES(TC_ConsoleOut, - {{"^BM_UserStats/iterations:5/repeats:3/manual_time [ " - "]*150 ns [ ]*150 ns [ ]*%time [ ]*5$"}, - {"^BM_UserStats/iterations:5/repeats:3/manual_time [ " - "]*150 ns [ ]*150 ns %time [ ]*5$"}, - {"^BM_UserStats/iterations:5/repeats:3/manual_time [ " - "]*150 ns [ ]*150 ns %time [ ]*5$"}, - {"^BM_UserStats/iterations:5/repeats:3/" - "manual_time_mean [ ]*150 ns [ ]*150 ns %time [ ]*3$"}, - {"^BM_UserStats/iterations:5/repeats:3/" - "manual_time_median [ ]*150 ns [ ]*150 ns %time [ ]*3$"}, - {"^BM_UserStats/iterations:5/repeats:3/" - "manual_time_stddev [ ]*0.000 ns [ ]*0.000 ns %time [ ]*3$"}, - {"^BM_UserStats/iterations:5/repeats:3/manual_time_cv " - "%console_percentage_report[ ]*$"}}); +ADD_CASES(TC_ConsoleOut, {{"^BM_UserStats/iterations:5/repeats:3/manual_time [ " + "]* 150 ns %time [ ]*5$"}, + {"^BM_UserStats/iterations:5/repeats:3/manual_time [ " + "]* 150 ns %time [ ]*5$"}, + {"^BM_UserStats/iterations:5/repeats:3/manual_time [ " + "]* 150 ns %time [ ]*5$"}, + {"^BM_UserStats/iterations:5/repeats:3/" + "manual_time_mean [ ]* 150 ns %time [ ]*3$"}, + {"^BM_UserStats/iterations:5/repeats:3/" + "manual_time_median [ ]* 150 ns %time [ ]*3$"}, + {"^BM_UserStats/iterations:5/repeats:3/" + "manual_time_stddev [ ]* 0.000 ns %time [ ]*3$"}, + {"^BM_UserStats/iterations:5/repeats:3/manual_time_ " + "[ ]* 150 ns %time [ ]*3$"}}); ADD_CASES( TC_JSONOut, {{"\"name\": \"BM_UserStats/iterations:5/repeats:3/manual_time\",$"}, @@ -981,19 +971,19 @@ BENCHMARK(BM_UserPercentStats) // anything else ADD_CASES(TC_ConsoleOut, {{"^BM_UserPercentStats/iterations:5/repeats:3/manual_time [ " - "]*150 ns [ ]*150 ns [ ]*%time [ ]*5$"}, + "]* 150 ns %time [ ]*5$"}, {"^BM_UserPercentStats/iterations:5/repeats:3/manual_time [ " - "]* 150 ns [ ]*150 ns [ ]*%time [ ]*5$"}, + "]* 150 ns %time [ ]*5$"}, {"^BM_UserPercentStats/iterations:5/repeats:3/manual_time [ " - "]* 150 ns [ ]*150 ns [ ]*%time [ ]*5$"}, + "]* 150 ns %time [ ]*5$"}, {"^BM_UserPercentStats/iterations:5/repeats:3/" - "manual_time_mean [ ]* 150 ns [ ]*150 ns [ ]*%time [ ]*3$"}, + "manual_time_mean [ ]* 150 ns %time [ ]*3$"}, {"^BM_UserPercentStats/iterations:5/repeats:3/" - "manual_time_median [ ]* 150 ns [ ]*150 ns [ ]*%time [ ]*3$"}, + "manual_time_median [ ]* 150 ns %time [ ]*3$"}, {"^BM_UserPercentStats/iterations:5/repeats:3/" - "manual_time_stddev [ ]* 0.000 ns [ ]*0.000 ns [ ]*%time [ ]*3$"}, - {"^BM_UserPercentStats/iterations:5/repeats:3/manual_time_cv " - "%console_percentage_report[ ]*$"}}); + "manual_time_stddev [ ]* 0.000 ns %time [ ]*3$"}, + {"^BM_UserPercentStats/iterations:5/repeats:3/manual_time_ " + "[ ]* 1.00 % [ ]* 1.00 %[ ]*3$"}}); ADD_CASES( TC_JSONOut, {{"\"name\": \"BM_UserPercentStats/iterations:5/repeats:3/manual_time\",$"}, diff --git a/test/user_counters_tabular_test.cc b/test/user_counters_tabular_test.cc index dcfe778bfd..cfc1ab069c 100644 --- a/test/user_counters_tabular_test.cc +++ b/test/user_counters_tabular_test.cc @@ -12,7 +12,7 @@ ADD_CASES(TC_ConsoleOut, // keeping these lines long improves readability, so: // clang-format off {"^[-]+$", MR_Next}, - {"^Benchmark %s Time %s Per-Thread Time %s CPU %s Iterations %s Bar %s Bat %s Baz %s Foo %s Frob %s Lob$", MR_Next}, + {"^Benchmark %s Time %s CPU %s Iterations %s Bar %s Bat %s Baz %s Foo %s Frob %s Lob$", MR_Next}, {"^[-]+$", MR_Next}, {"^BM_Counters_Tabular/repeats:2/threads:1 %console_report [ ]*%hrfloat [ ]*%hrfloat [ ]*%hrfloat [ ]*%hrfloat [ ]*%hrfloat [ ]*%hrfloat$", MR_Next}, {"^BM_Counters_Tabular/repeats:2/threads:1 %console_report [ ]*%hrfloat [ ]*%hrfloat [ ]*%hrfloat [ ]*%hrfloat [ ]*%hrfloat [ ]*%hrfloat$", MR_Next}, @@ -32,7 +32,7 @@ ADD_CASES(TC_ConsoleOut, {"^BM_CounterRates_Tabular/threads:%int %console_report [ ]*%hrfloat/s [ ]*%hrfloat/s [ ]*%hrfloat/s [ ]*%hrfloat/s [ ]*%hrfloat/s [ ]*%hrfloat/s$", MR_Next}, {"^BM_CounterRates_Tabular/threads:%int %console_report [ ]*%hrfloat/s [ ]*%hrfloat/s [ ]*%hrfloat/s [ ]*%hrfloat/s [ ]*%hrfloat/s [ ]*%hrfloat/s$", MR_Next}, {"^[-]+$", MR_Next}, - {"^Benchmark %s Time %s Per-Thread Time %s CPU %s Iterations %s Bar %s Baz %s Foo$", MR_Next}, + {"^Benchmark %s Time %s CPU %s Iterations %s Bar %s Baz %s Foo$", MR_Next}, {"^[-]+$", MR_Next}, {"^BM_CounterSet0_Tabular/threads:%int %console_report [ ]*%hrfloat [ ]*%hrfloat [ ]*%hrfloat$", MR_Next}, {"^BM_CounterSet0_Tabular/threads:%int %console_report [ ]*%hrfloat [ ]*%hrfloat [ ]*%hrfloat$", MR_Next}, @@ -45,12 +45,12 @@ ADD_CASES(TC_ConsoleOut, {"^BM_CounterSet1_Tabular/threads:%int %console_report [ ]*%hrfloat [ ]*%hrfloat [ ]*%hrfloat$", MR_Next}, {"^BM_CounterSet1_Tabular/threads:%int %console_report [ ]*%hrfloat [ ]*%hrfloat [ ]*%hrfloat$", MR_Next}, {"^[-]+$", MR_Next}, - {"^Benchmark %s Time %s Per-Thread Time %s CPU %s Iterations %s Bat %s Baz %s Foo$", MR_Next}, + {"^Benchmark %s Time %s CPU %s Iterations %s Bat %s Baz %s Foo$", MR_Next}, {"^[-]+$", MR_Next}, {"^BM_CounterSet2_Tabular/threads:%int %console_report [ ]*%hrfloat [ ]*%hrfloat [ ]*%hrfloat$", MR_Next}, {"^BM_CounterSet2_Tabular/threads:%int %console_report [ ]*%hrfloat [ ]*%hrfloat [ ]*%hrfloat$", MR_Next}, {"^BM_CounterSet2_Tabular/threads:%int %console_report [ ]*%hrfloat [ ]*%hrfloat [ ]*%hrfloat$", MR_Next}, - //{"^BM_CounterSet2_Tabular/threads:%int %console_report [ ]*%hrfloat [ ]*%hrfloat [ ]*%hrfloat$", MR_Next}, + {"^BM_CounterSet2_Tabular/threads:%int %console_report [ ]*%hrfloat [ ]*%hrfloat [ ]*%hrfloat$", MR_Next}, {"^BM_CounterSet2_Tabular/threads:%int %console_report [ ]*%hrfloat [ ]*%hrfloat [ ]*%hrfloat$"}, // clang-format on }); @@ -221,7 +221,6 @@ ADD_CASES(TC_JSONOut, {"\"threads\": 2,$", MR_Next}, {"\"iterations\": %int,$", MR_Next}, {"\"real_time\": %float,$", MR_Next}, - {"\"per_thread_real_time\": %float,$", MR_Next}, {"\"cpu_time\": %float,$", MR_Next}, {"\"time_unit\": \"ns\",$", MR_Next}, {"\"Bar\": %float,$", MR_Next}, @@ -243,7 +242,6 @@ ADD_CASES(TC_JSONOut, {"\"threads\": 2,$", MR_Next}, {"\"iterations\": %int,$", MR_Next}, {"\"real_time\": %float,$", MR_Next}, - {"\"per_thread_real_time\": %float,$", MR_Next}, {"\"cpu_time\": %float,$", MR_Next}, {"\"time_unit\": \"ns\",$", MR_Next}, {"\"Bar\": %float,$", MR_Next}, @@ -266,7 +264,6 @@ ADD_CASES(TC_JSONOut, {"\"aggregate_unit\": \"time\",$", MR_Next}, {"\"iterations\": %int,$", MR_Next}, {"\"real_time\": %float,$", MR_Next}, - {"\"per_thread_real_time\": %float,$", MR_Next}, {"\"cpu_time\": %float,$", MR_Next}, {"\"time_unit\": \"ns\",$", MR_Next}, {"\"Bar\": %float,$", MR_Next}, @@ -289,7 +286,6 @@ ADD_CASES(TC_JSONOut, {"\"aggregate_unit\": \"time\",$", MR_Next}, {"\"iterations\": %int,$", MR_Next}, {"\"real_time\": %float,$", MR_Next}, - {"\"per_thread_real_time\": %float,$", MR_Next}, {"\"cpu_time\": %float,$", MR_Next}, {"\"time_unit\": \"ns\",$", MR_Next}, {"\"Bar\": %float,$", MR_Next}, @@ -312,7 +308,6 @@ ADD_CASES(TC_JSONOut, {"\"aggregate_unit\": \"percentage\",$", MR_Next}, {"\"iterations\": %int,$", MR_Next}, {"\"real_time\": %float,$", MR_Next}, - {"\"per_thread_real_time\": %float,$", MR_Next}, {"\"cpu_time\": %float,$", MR_Next}, {"\"time_unit\": \"ns\",$", MR_Next}, {"\"Bar\": %float,$", MR_Next}, @@ -486,10 +481,9 @@ void BM_CounterSet1_Tabular(benchmark::State& state) { {"Baz", {45, bm::Counter::kAvgThreads}}, }); } -BENCHMARK(BM_CounterSet1_Tabular)->Threads(1); -BENCHMARK(BM_CounterSet1_Tabular)->ThreadRange(2, 16); +BENCHMARK(BM_CounterSet1_Tabular)->ThreadRange(1, 16); ADD_CASES(TC_JSONOut, - {{"\"name\": \"BM_CounterSet1_Tabular/threads:1\",$"}, + {{"\"name\": \"BM_CounterSet1_Tabular/threads:%int\",$"}, {"\"family_index\": 3,$", MR_Next}, {"\"per_family_instance_index\": 0,$", MR_Next}, {"\"run_name\": \"BM_CounterSet1_Tabular/threads:%int\",$", MR_Next}, @@ -505,24 +499,6 @@ ADD_CASES(TC_JSONOut, {"\"Baz\": %float,$", MR_Next}, {"\"Foo\": %float$", MR_Next}, {"}", MR_Next}}); -ADD_CASES(TC_JSONOut, - {{"\"name\": \"BM_CounterSet1_Tabular/threads:%int\",$"}, - {"\"family_index\": 4,$", MR_Next}, - {"\"per_family_instance_index\": 0,$", MR_Next}, - {"\"run_name\": \"BM_CounterSet1_Tabular/threads:%int\",$", MR_Next}, - {"\"run_type\": \"iteration\",$", MR_Next}, - {"\"repetitions\": 1,$", MR_Next}, - {"\"repetition_index\": 0,$", MR_Next}, - {"\"threads\": 2,$", MR_Next}, - {"\"iterations\": %int,$", MR_Next}, - {"\"real_time\": %float,$", MR_Next}, - {"\"per_thread_real_time\": %float,$", MR_Next}, - {"\"cpu_time\": %float,$", MR_Next}, - {"\"time_unit\": \"ns\",$", MR_Next}, - {"\"Bar\": %float,$", MR_Next}, - {"\"Baz\": %float,$", MR_Next}, - {"\"Foo\": %float$", MR_Next}, - {"}", MR_Next}}); ADD_CASES(TC_CSVOut, {{"^\"BM_CounterSet1_Tabular/threads:%int\",%csv_report," "%float,,%float,%float,,"}}); // VS2013 does not allow this function to be passed as a lambda argument @@ -549,19 +525,18 @@ void BM_CounterSet2_Tabular(benchmark::State& state) { {"Baz", {40, bm::Counter::kAvgThreads}}, }); } -BENCHMARK(BM_CounterSet2_Tabular)->ThreadRange(2, 16); +BENCHMARK(BM_CounterSet2_Tabular)->ThreadRange(1, 16); ADD_CASES(TC_JSONOut, {{"\"name\": \"BM_CounterSet2_Tabular/threads:%int\",$"}, - {"\"family_index\": 5,$", MR_Next}, + {"\"family_index\": 4,$", MR_Next}, {"\"per_family_instance_index\": 0,$", MR_Next}, {"\"run_name\": \"BM_CounterSet2_Tabular/threads:%int\",$", MR_Next}, {"\"run_type\": \"iteration\",$", MR_Next}, {"\"repetitions\": 1,$", MR_Next}, {"\"repetition_index\": 0,$", MR_Next}, - {"\"threads\": 2,$", MR_Next}, + {"\"threads\": 1,$", MR_Next}, {"\"iterations\": %int,$", MR_Next}, {"\"real_time\": %float,$", MR_Next}, - {"\"per_thread_real_time\": %float,$", MR_Next}, {"\"cpu_time\": %float,$", MR_Next}, {"\"time_unit\": \"ns\",$", MR_Next}, {"\"Bat\": %float,$", MR_Next}, diff --git a/test/user_counters_test.cc b/test/user_counters_test.cc index 73ec217373..22252acbf6 100644 --- a/test/user_counters_test.cc +++ b/test/user_counters_test.cc @@ -12,7 +12,7 @@ ADD_CASES(TC_ConsoleOut, {{"^[-]+$", MR_Next}, - {"^Benchmark %s Time %s Per-Thread Time %s CPU %s Iterations UserCounters...$", MR_Next}, + {"^Benchmark %s Time %s CPU %s Iterations UserCounters...$", MR_Next}, {"^[-]+$", MR_Next}}); ADD_CASES(TC_CSVOut, {{"%csv_header,\"bar\",\"foo\""}}); From 5fde8c053dc22bb395775202e3076219a3ecb275 Mon Sep 17 00:00:00 2001 From: Dominic Hamon Date: Fri, 9 Aug 2024 16:33:45 +0100 Subject: [PATCH 5/7] remove unused statements --- src/benchmark_runner.cc | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/benchmark_runner.cc b/src/benchmark_runner.cc index 20f9bda056..a38093937a 100644 --- a/src/benchmark_runner.cc +++ b/src/benchmark_runner.cc @@ -292,9 +292,6 @@ BenchmarkRunner::IterationResults BenchmarkRunner::DoNIterations() { // And get rid of the manager. manager.reset(); - i.results.real_time_used; - i.results.manual_time_used; - BM_VLOG(2) << "Ran in " << i.results.cpu_time_used << "/" << i.results.real_time_used << "\n"; From f834669b34e4794651a0e8966a6a72adfaee5f81 Mon Sep 17 00:00:00 2001 From: Dominic Hamon Date: Fri, 9 Aug 2024 16:33:58 +0100 Subject: [PATCH 6/7] clang-format --- src/console_reporter.cc | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/console_reporter.cc b/src/console_reporter.cc index 28272d8e3c..3e3bd02249 100644 --- a/src/console_reporter.cc +++ b/src/console_reporter.cc @@ -59,9 +59,9 @@ bool ConsoleReporter::ReportContext(const Context& context) { BENCHMARK_EXPORT void ConsoleReporter::PrintHeader(const Run& run) { - std::string str = FormatString( - "%-*s %13s %15s %12s", static_cast(name_field_width_), - "Benchmark", "Time", "CPU", "Iterations"); + std::string str = + FormatString("%-*s %13s %15s %12s", static_cast(name_field_width_), + "Benchmark", "Time", "CPU", "Iterations"); if (!run.counters.empty()) { if (output_options_ & OO_Tabular) { for (auto const& c : run.counters) { @@ -157,17 +157,16 @@ void ConsoleReporter::PrintRunData(const Run& result) { if (result.report_big_o) { std::string big_o = GetBigOString(result.complexity); - printer(Out, COLOR_YELLOW, "%10.2f %-4s %10.2f %-4s ", - real_time, big_o.c_str(), cpu_time, big_o.c_str()); + printer(Out, COLOR_YELLOW, "%10.2f %-4s %10.2f %-4s ", real_time, + big_o.c_str(), cpu_time, big_o.c_str()); } else if (result.report_rms) { - printer(Out, COLOR_YELLOW, "%10.0f %-4s %10.0f %-4s ", - real_time * 100, "%", "%", cpu_time * 100, "%"); + printer(Out, COLOR_YELLOW, "%10.0f %-4s %10.0f %-4s ", real_time * 100, "%", + "%", cpu_time * 100, "%"); } else if (result.run_type != Run::RT_Aggregate || result.aggregate_unit == StatisticUnit::kTime) { const char* timeLabel = GetTimeUnitString(result.time_unit); - printer(Out, COLOR_YELLOW, "%s %-4s %s %-4s ", - real_time_str.c_str(), timeLabel, - cpu_time_str.c_str(), timeLabel); + printer(Out, COLOR_YELLOW, "%s %-4s %s %-4s ", real_time_str.c_str(), + timeLabel, cpu_time_str.c_str(), timeLabel); } else { assert(result.aggregate_unit == StatisticUnit::kPercentage); printer(Out, COLOR_YELLOW, "%10.2f %-4s %10.2f %-4s ", From 4827765707deb1e6996afa134a4ae20502d9e1c9 Mon Sep 17 00:00:00 2001 From: Dominic Hamon Date: Fri, 9 Aug 2024 16:58:50 +0100 Subject: [PATCH 7/7] left a bit behind by mistake --- src/console_reporter.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/console_reporter.cc b/src/console_reporter.cc index 3e3bd02249..35c3de2a4d 100644 --- a/src/console_reporter.cc +++ b/src/console_reporter.cc @@ -161,7 +161,7 @@ void ConsoleReporter::PrintRunData(const Run& result) { big_o.c_str(), cpu_time, big_o.c_str()); } else if (result.report_rms) { printer(Out, COLOR_YELLOW, "%10.0f %-4s %10.0f %-4s ", real_time * 100, "%", - "%", cpu_time * 100, "%"); + cpu_time * 100, "%"); } else if (result.run_type != Run::RT_Aggregate || result.aggregate_unit == StatisticUnit::kTime) { const char* timeLabel = GetTimeUnitString(result.time_unit);