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