5 #ifndef FABCOIN_BENCH_BENCH_H 6 #define FABCOIN_BENCH_BENCH_H 15 #include <boost/preprocessor/cat.hpp> 16 #include <boost/preprocessor/stringize.hpp> 66 State(std::string
name, uint64_t num_evals,
double num_iters,
Printer& printer) : m_name(name), m_num_iters_left(0), m_num_iters(num_iters), m_num_evals(num_evals)
72 if (m_num_iters_left--) {
76 bool result = UpdateTimer(clock::now());
78 m_start_time = clock::now();
92 static BenchmarkMap& benchmarks();
95 BenchRunner(std::string
name, BenchFunction func, uint64_t num_iters_for_one_second);
97 static void RunAll(
Printer& printer, uint64_t num_evals,
double scaling,
const std::string& filter,
bool is_list_only);
105 virtual void header() = 0;
106 virtual void result(
const State& state) = 0;
107 virtual void footer() = 0;
115 void result(
const State& state);
123 PlotlyPrinter(std::string plotly_url, int64_t width, int64_t height);
125 void result(
const State& state);
139 #define BENCHMARK(n, num_iters_for_one_second) \ 140 benchmark::BenchRunner BOOST_PP_CAT(bench_, BOOST_PP_CAT(__LINE__, n))(BOOST_PP_STRINGIZE(n), n, (num_iters_for_one_second)); 142 #endif // FABCOIN_BENCH_BENCH_H const uint64_t m_num_iters
std::chrono::steady_clock steady_clock
std::vector< double > m_elapsed_results
uint64_t m_num_iters_left
State(std::string name, uint64_t num_evals, double num_iters, Printer &printer)
const uint64_t m_num_evals
std::function< void(State &)> BenchFunction
std::chrono::high_resolution_clock hi_res_clock
std::map< std::string, Bench > BenchmarkMap
std::conditional< hi_res_clock::is_steady, hi_res_clock, steady_clock >::type type
PlatformStyle::TableColorType type
uint64_t num_iters_for_one_second
clock::time_point time_point