1#ifndef BENCHMARK_API_INTERNAL_H
2#define BENCHMARK_API_INTERNAL_H
3
4#include <cmath>
5#include <iosfwd>
6#include <limits>
7#include <memory>
8#include <string>
9#include <vector>
10
11#include "benchmark/benchmark.h"
12#include "commandlineflags.h"
13
14namespace benchmark {
15namespace internal {
16
17// Information kept per benchmark we may want to run
18class BenchmarkInstance {
19 public:
20 BenchmarkInstance(Benchmark* benchmark, const std::vector<int64_t>& args,
21 int threads);
22
23 const BenchmarkName& name() const { return name_; }
24 AggregationReportMode aggregation_report_mode() const {
25 return aggregation_report_mode_;
26 }
27 TimeUnit time_unit() const { return time_unit_; }
28 bool measure_process_cpu_time() const { return measure_process_cpu_time_; }
29 bool use_real_time() const { return use_real_time_; }
30 bool use_manual_time() const { return use_manual_time_; }
31 BigO complexity() const { return complexity_; }
32 BigOFunc& complexity_lambda() const { return *complexity_lambda_; }
33 const std::vector<Statistics>& statistics() const { return statistics_; }
34 int repetitions() const { return repetitions_; }
35 double min_time() const { return min_time_; }
36 IterationCount iterations() const { return iterations_; }
37 int threads() const { return threads_; }
38
39 bool last_benchmark_instance;
40
41 State Run(IterationCount iters, int thread_id, internal::ThreadTimer* timer,
42 internal::ThreadManager* manager,
43 internal::PerfCountersMeasurement* perf_counters_measurement) const;
44
45 private:
46 BenchmarkName name_;
47 Benchmark& benchmark_;
48 AggregationReportMode aggregation_report_mode_;
49 const std::vector<int64_t>& args_;
50 TimeUnit time_unit_;
51 bool measure_process_cpu_time_;
52 bool use_real_time_;
53 bool use_manual_time_;
54 BigO complexity_;
55 BigOFunc* complexity_lambda_;
56 UserCounters counters_;
57 const std::vector<Statistics>& statistics_;
58 int repetitions_;
59 double min_time_;
60 IterationCount iterations_;
61 int threads_; // Number of concurrent threads to us
62};
63
64bool FindBenchmarksInternal(const std::string& re,
65 std::vector<BenchmarkInstance>* benchmarks,
66 std::ostream* Err);
67
68bool IsZero(double n);
69
70ConsoleReporter::OutputOptions GetOutputOptions(bool force_no_color = false);
71
72} // end namespace internal
73} // end namespace benchmark
74
75#endif // BENCHMARK_API_INTERNAL_H
76