5 #ifndef BITCOIN_BENCH_BENCH_H 6 #define BITCOIN_BENCH_BENCH_H 15 #include <boost/preprocessor/cat.hpp> 16 #include <boost/preprocessor/stringize.hpp> 46 using type = std::conditional<hi_res_clock::is_steady, hi_res_clock, steady_clock>::type;
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;
107 virtual void footer() = 0;
123 PlotlyPrinter(std::string plotly_url, int64_t width, int64_t height);
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 // BITCOIN_BENCH_BENCH_H void result(const State &state) override
BenchRunner(std::string name, BenchFunction func, uint64_t num_iters_for_one_second)
const uint64_t m_num_iters
void result(const State &state) override
std::chrono::steady_clock steady_clock
std::vector< double > m_elapsed_results
virtual void result(const State &state)=0
bool UpdateTimer(time_point finish_time)
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
static void RunAll(Printer &printer, uint64_t num_evals, double scaling, const std::string &filter, bool is_list_only)
std::conditional< hi_res_clock::is_steady, hi_res_clock, steady_clock >::type type
uint64_t num_iters_for_one_second
clock::time_point time_point
static BenchmarkMap & benchmarks()
PlotlyPrinter(std::string plotly_url, int64_t width, int64_t height)