[X86] combineTargetShuffle - commute VPERMV3 shuffles so any load is on the RHS
[llvm-project.git] / third-party / benchmark / src / benchmark_api_internal.h
blob94f516531bc4faa2665aab89c211fc49fc76a918
1 #ifndef BENCHMARK_API_INTERNAL_H
2 #define BENCHMARK_API_INTERNAL_H
4 #include <cmath>
5 #include <iosfwd>
6 #include <limits>
7 #include <memory>
8 #include <string>
9 #include <vector>
11 #include "benchmark/benchmark.h"
12 #include "commandlineflags.h"
14 namespace benchmark {
15 namespace internal {
17 // Information kept per benchmark we may want to run
18 class BenchmarkInstance {
19 public:
20 BenchmarkInstance(Benchmark* benchmark, int family_index,
21 int per_family_instance_index,
22 const std::vector<int64_t>& args, int threads);
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_;
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;
45 State Run(IterationCount iters, int thread_id, internal::ThreadTimer* timer,
46 internal::ThreadManager* manager,
47 internal::PerfCountersMeasurement* perf_counters_measurement) const;
49 private:
50 BenchmarkName name_;
51 Benchmark& benchmark_;
52 const int family_index_;
53 const int per_family_instance_index_;
54 AggregationReportMode aggregation_report_mode_;
55 const std::vector<int64_t>& args_;
56 TimeUnit time_unit_;
57 bool measure_process_cpu_time_;
58 bool use_real_time_;
59 bool use_manual_time_;
60 BigO complexity_;
61 BigOFunc* complexity_lambda_;
62 UserCounters counters_;
63 const std::vector<Statistics>& statistics_;
64 int repetitions_;
65 double min_time_;
66 double min_warmup_time_;
67 IterationCount iterations_;
68 int threads_; // Number of concurrent threads to us
70 typedef void (*callback_function)(const benchmark::State&);
71 callback_function setup_ = nullptr;
72 callback_function teardown_ = nullptr;
75 bool FindBenchmarksInternal(const std::string& re,
76 std::vector<BenchmarkInstance>* benchmarks,
77 std::ostream* Err);
79 bool IsZero(double n);
81 BENCHMARK_EXPORT
82 ConsoleReporter::OutputOptions GetOutputOptions(bool force_no_color = false);
84 } // end namespace internal
85 } // end namespace benchmark
87 #endif // BENCHMARK_API_INTERNAL_H