51 measurers_.push_back(std::make_shared<measurer::ProcessingTimeMeasurer>(
54 measurers_.push_back(std::make_shared<measurer::MeanProcessingTimeMeasurer>(
58 reporters_.push_back(std::make_shared<reporter::ConsoleReporter>());
62 std::make_shared<reporter::PlotReporter>(config.plot_prefix));
67 std::make_shared<reporter::JsonReporter>(config.json_file_path));
71 reporters_.push_back(std::make_shared<reporter::MsgPackReporter>(
72 config.msgpack_file_path));
77 std::make_shared<reporter::CompressedMsgPackReporter>(
78 config.compressed_msgpack_file_path));
83 filter.include_with_glob(pattern);
86 filter.exclude_with_glob(pattern);
89 filter.include_with_regex(regex);
92 filter.exclude_with_regex(regex);
98 : registry_(registry) {}
104 for (
const auto&
reporter : reporters_) {
105 reporter->experiment_starts(time_stamp);
108 for (
const auto&
measurer : measurers_) {
109 for (
const auto&
reporter : reporters_) {
113 for (
const auto& group_pair : registry_.benchmarks()) {
114 const auto& group = group_pair.second;
115 for (
const auto&
reporter : reporters_) {
116 reporter->group_starts(group.name(), group.config());
119 for (
const auto& bench_case_pair : group.cases()) {
120 const auto& bench_case = bench_case_pair.second;
124 for (
const auto&
reporter : reporters_) {
125 reporter->group_finished(group.name());
129 for (
const auto&
reporter : reporters_) {
135 for (
const auto&
reporter : reporters_) {
136 reporter->experiment_finished(time_stamp);
140void Runner::run_case(
const std::shared_ptr<measurer::IMeasurer>&
measurer,
141 const std::shared_ptr<bench_impl::IBenchmarkCase>& bench_case)
const {
142 auto params = bench_case->params();
143 auto generator = params.create_generator();
148 run_case_with_condition(
measurer, bench_case, cond);
150 if (!generator.iterate()) {
156void Runner::run_case_with_condition(
157 const std::shared_ptr<measurer::IMeasurer>& measurer,
158 const std::shared_ptr<bench_impl::IBenchmarkCase>& bench_case,
159 const BenchmarkCondition& cond)
const {
160 for (
const auto& reporter : reporters_) {
161 reporter->case_starts(bench_case->info());
164 std::exception_ptr error_in_reporter;
166 const auto measurement = measurer->measure(bench_case.get(), cond);
169 for (
const auto& reporter : reporters_) {
170 reporter->measurement_succeeded(measurement);
173 error_in_reporter = std::current_exception();
176 const auto error = std::current_exception();
177 for (
const auto& reporter : reporters_) {
178 reporter->measurement_failed(bench_case->info(), cond, error);
181 if (error_in_reporter) {
182 std::rethrow_exception(error_in_reporter);
185 for (
const auto& reporter : reporters_) {
186 reporter->case_finished(bench_case->info());
Definition of BenchmarkCaseName class.
Definition of BenchmarkCaseRegistry class.
Definition of BenchmarkCondition class.
Definition of BenchmarkGroup class.
Definition of BenchmarkGroupName class.
Class of conditions of benchmarks.
Class of registry of cases of benchmarks.
void filter_by(const filters::ComposedFilter &filter)
Filter.
static auto now() -> SystemTimePoint
Get the current time.
Class of composed filters of benchmarks.
void run() const
Run benchmarks.
Runner(const Config &config, bench_impl::BenchmarkCaseRegistry ®istry=bench_impl::BenchmarkCaseRegistry::instance())
Constructor.
Definition of ComposedFilter class.
Definition of CompressedMsgPackReporter class.
Definition of ConsoleReporter class.
Definition of JsonReporter class.
Definition of MeanProcessingTimeMeasurer class.
Definition of MsgPackReporter class.
Namespace of classes to measure time in benchmarks.
Namespace of reporters of results of benchmarks.
Namespace of classes to run benchmarks.
Namespace of stat_bench source codes.
Definition of OrderedMap class.
Definition of ParameterConfig class.
Definition of ParameterGenerator class.
Definition of PlotReporter class.
Definition of ProcessingTimeMeasurer class.
Definition of Runner class.
std::vector< std::string > include_regex
Regular expressions of benchmark names to include.
std::size_t min_warming_up_iterations
Minimum number of iterations for warming up.
std::string json_file_path
File path of JSON data file.
std::string msgpack_file_path
File path of MsgPack data file.
std::size_t processing_time_samples
Number of samples for measurements of processing time.
double min_warming_up_duration_sec
Minimum duration for warming up. [sec].
double min_sample_duration_sec
Minimum duration of a sample for measurement of mean processing time. [sec].
std::string plot_prefix
Prefix of filepaths to generate plots.
std::vector< std::string > include_glob
Glob patterns of benchmark names to include.
std::size_t mean_processing_time_samples
Number of samples for measurements of mean processing time.
std::vector< std::string > exclude_regex
Regular expressions of benchmark names to exclude.
std::vector< std::string > exclude_glob
Glob patterns of benchmark names to exclude.
std::string compressed_msgpack_file_path
File path of compressed MsgPack data file.
Definition of SystemClock class.
Definition of SystemTimePoint class.