Fix column width calculation and remove duplicate test
diff --git a/src/benchmark.cc b/src/benchmark.cc index d526216..5928895 100644 --- a/src/benchmark.cc +++ b/src/benchmark.cc
@@ -802,26 +802,14 @@ auto families = benchmark::internal::BenchmarkFamilies::GetInstance(); if (!families->FindBenchmarks(spec, &benchmarks)) return; - // Determine the width of the name field using a minimum width of 10. - // Also determine max number of threads needed. size_t name_field_width = 10; for (const internal::Benchmark::Instance& benchmark : benchmarks) { - // Add width for _stddev and threads:XX - if (benchmark.threads > 1 && FLAGS_benchmark_repetitions > 1) { - name_field_width = - std::max<size_t>(name_field_width, benchmark.name.size() + 17); - } else if (benchmark.threads > 1) { - name_field_width = - std::max<size_t>(name_field_width, benchmark.name.size() + 10); - } else if (FLAGS_benchmark_repetitions > 1) { - name_field_width = - std::max<size_t>(name_field_width, benchmark.name.size() + 7); - } else { - name_field_width = - std::max<size_t>(name_field_width, benchmark.name.size()); - } + name_field_width = + std::max<size_t>(name_field_width, benchmark.name.size()); } + if (FLAGS_benchmark_repetitions > 1) + name_field_width += std::strlen("_stddev"); // Print header here BenchmarkReporter::Context context;
diff --git a/test/benchmark_test.cc b/test/benchmark_test.cc index e835608..751df85 100644 --- a/test/benchmark_test.cc +++ b/test/benchmark_test.cc
@@ -58,17 +58,7 @@ state.SetLabel(ss.str()); } BENCHMARK(BM_Factorial); - -static void BM_FactorialRealTime(benchmark::State& state) { - int fac_42 = 0; - while (state.KeepRunning()) - fac_42 = Factorial(8); - // Prevent compiler optimizations - std::stringstream ss; - ss << fac_42; - state.SetLabel(ss.str()); -} -BENCHMARK(BM_FactorialRealTime)->UseRealTime(); +BENCHMARK(BM_Factorial)->UseRealTime(); static void BM_CalculatePiRange(benchmark::State& state) { double pi = 0.0;