benchmark 1.10.0
Loading...
Searching...
No Matches
benchmark_api_internal.h
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_api.h"
12#include "benchmark/reporter.h"
13#include "benchmark/sysinfo.h"
14#include "commandlineflags.h"
15
16namespace benchmark {
17namespace internal {
18
19// Information kept per benchmark we may want to run
20class BenchmarkInstance {
21 public:
22 BenchmarkInstance(benchmark::Benchmark* benchmark, int family_idx,
23 int per_family_instance_idx,
24 const std::vector<int64_t>& args, int thread_count);
25
26 const BenchmarkName& name() const { return name_; }
27 int family_index() const { return family_index_; }
28 int per_family_instance_index() const { return per_family_instance_index_; }
29 AggregationReportMode aggregation_report_mode() const {
30 return aggregation_report_mode_;
31 }
32 TimeUnit time_unit() const { return time_unit_; }
33 bool measure_process_cpu_time() const { return measure_process_cpu_time_; }
34 bool use_real_time() const { return use_real_time_; }
35 bool use_manual_time() const { return use_manual_time_; }
36 BigO complexity() const { return complexity_; }
37 BigOFunc* complexity_lambda() const { return complexity_lambda_; }
38 const std::vector<Statistics>& statistics() const { return statistics_; }
39 int repetitions() const { return repetitions_; }
40 double min_time() const { return min_time_; }
41 double min_warmup_time() const { return min_warmup_time_; }
42 IterationCount iterations() const { return iterations_; }
43 int threads() const { return threads_; }
44 void Setup() const;
45 void Teardown() const;
46 const auto& GetUserThreadRunnerFactory() const {
47 return benchmark_.threadrunner_;
48 }
49
50 State Run(IterationCount iters, int thread_id, internal::ThreadTimer* timer,
52 internal::PerfCountersMeasurement* perf_counters_measurement,
53 ProfilerManager* profiler_manager) const;
54
55 private:
56 BenchmarkName name_;
57 benchmark::Benchmark& benchmark_;
58 const int family_index_;
59 const int per_family_instance_index_;
60 AggregationReportMode aggregation_report_mode_;
61 const std::vector<int64_t>& args_;
62 TimeUnit time_unit_;
63 bool measure_process_cpu_time_;
64 bool use_real_time_;
65 bool use_manual_time_;
66 BigO complexity_;
67 BigOFunc* complexity_lambda_;
68 UserCounters counters_;
69 const std::vector<Statistics>& statistics_;
70 int repetitions_;
71 double min_time_;
72 double min_warmup_time_;
73 IterationCount iterations_;
74 int threads_; // Number of concurrent threads to us
75
76 callback_function setup_;
77 callback_function teardown_;
78};
79
80BENCHMARK_EXPORT
81bool FindBenchmarksInternal(const std::string& re,
82 std::vector<BenchmarkInstance>* benchmarks,
83 std::ostream* Err);
84
85bool IsZero(double n);
86
87BENCHMARK_EXPORT
88ConsoleReporter::OutputOptions GetOutputOptions(bool force_no_color = false);
89
90} // end namespace internal
91} // end namespace benchmark
92
93#endif // BENCHMARK_API_INTERNAL_H
Definition benchmark_api.h:94
Definition managers.h:55
Definition state.h:43
Definition perf_counters.h:152
Definition thread_manager.h:14
Definition thread_timer.h:10
Definition reporter.h:43