Skip to content

Commit

Permalink
cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
dmah42 committed Sep 12, 2024
1 parent 49df5bd commit d663b9b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 31 deletions.
37 changes: 17 additions & 20 deletions src/benchmark_runner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@

namespace benchmark {

BM_DECLARE_bool(benchmark_dry_run);
BM_DECLARE_string(benchmark_min_time);
BM_DECLARE_double(benchmark_min_warmup_time);
BM_DECLARE_int32(benchmark_repetitions);
BM_DECLARE_bool(benchmark_report_aggregates_only);
BM_DECLARE_bool(benchmark_display_aggregates_only);
BM_DECLARE_string(benchmark_perf_counters);

namespace internal {

MemoryManager* memory_manager = nullptr;
Expand Down Expand Up @@ -228,32 +236,21 @@ BenchmarkRunner::BenchmarkRunner(
: b(b_),
reports_for_family(reports_for_family_),
parsed_benchtime_flag(ParseBenchMinTime(FLAGS_benchmark_min_time)),
min_time(FLAGS_benchmark_dry_run ? 0 : ComputeMinTime(b_, parsed_benchtime_flag)),
min_warmup_time(FLAGS_benchmark_dry_run ? 0 : ((!IsZero(b.min_time()) && b.min_warmup_time() > 0.0)
? b.min_warmup_time()
: FLAGS_benchmark_min_warmup_time)),
warmup_done(FLAGS_benchmark_dry_run ? true : !(min_warmup_time > 0.0)),
repeats(FLAGS_benchmark_dry_run ? 1 : (b.repetitions() != 0 ? b.repetitions()
: FLAGS_benchmark_repetitions)),
has_explicit_iteration_count(b.iterations() != 0 ||
parsed_benchtime_flag.tag ==
BenchTimeType::ITERS),
pool(static_cast<size_t>(b.threads() - 1)),
iters(has_explicit_iteration_count
iters(FLAGS_benchmark_dry_run ? 1 : (has_explicit_iteration_count
? ComputeIters(b_, parsed_benchtime_flag)
: 1),
: 1)),
perf_counters_measurement_ptr(pcm_) {
if (FLAGS_benchmark_dry_run) {
min_time = 0;
min_warmup_time = 0;
warmup_done = true;
repeats = 1;
iters = 1;
} else {
min_time = ComputeMinTime(b_, parsed_benchtime_flag);
min_warmup_time = ((!IsZero(b.min_time()) && b.min_warmup_time() > 0.0)
? b.min_warmup_time()
: FLAGS_benchmark_min_warmup_time);
warmup_done = !(min_warmup_time > 0.0);
repeats =
b.repetitions() != 0 ? b.repetitions() : FLAGS_benchmark_repetitions;
iters = has_explicit_iteration_count
? ComputeIters(b_, parsed_benchtime_flag)
: 1;
}
run_results.display_report_aggregates_only =
(FLAGS_benchmark_report_aggregates_only ||
FLAGS_benchmark_display_aggregates_only);
Expand Down
14 changes: 3 additions & 11 deletions src/benchmark_runner.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,6 @@

namespace benchmark {

BM_DECLARE_string(benchmark_min_time);
BM_DECLARE_double(benchmark_min_warmup_time);
BM_DECLARE_int32(benchmark_repetitions);
BM_DECLARE_bool(benchmark_dry_run);
BM_DECLARE_bool(benchmark_report_aggregates_only);
BM_DECLARE_bool(benchmark_display_aggregates_only);
BM_DECLARE_string(benchmark_perf_counters);

namespace internal {

extern MemoryManager* memory_manager;
Expand Down Expand Up @@ -90,10 +82,10 @@ class BenchmarkRunner {
BenchmarkReporter::PerFamilyRunReports* reports_for_family;

BenchTimeType parsed_benchtime_flag;
double min_time;
double min_warmup_time;
const double min_time;
const double min_warmup_time;
bool warmup_done;
int repeats;
const int repeats;
const bool has_explicit_iteration_count;

int num_repetitions_done = 0;
Expand Down

0 comments on commit d663b9b

Please sign in to comment.