diff --git a/src/console_reporter.cc b/src/console_reporter.cc index 35c3de2a4..10edacff9 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 b8c8c94c0..b65a2ca79 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 0729d15aa..268cffedc 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 265f28aae..cc61bb9c3 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 7867165d1..63b2d9807 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 cfc1ab069..dcfe778bf 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 22252acbf..73ec21737 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\""}});