Ejemplo n.º 1
0
void benchmark::BenchRunner::RunAll(Printer& printer, uint64_t num_evals, double scaling, const std::string& filter, bool is_list_only)
{
    if (!std::ratio_less_equal<benchmark::clock::period, std::micro>::value) {
        std::cerr << "WARNING: Clock precision is worse than microsecond - benchmarks may be less accurate!\n";
    }
#ifdef DEBUG
    std::cerr << "WARNING: This is a debug build - may result in slower benchmarks.\n";
#endif

    std::regex reFilter(filter);
    std::smatch baseMatch;

    printer.header();

    for (const auto& p : benchmarks()) {
        if (!std::regex_match(p.first, baseMatch, reFilter)) {
            continue;
        }

        uint64_t num_iters = static_cast<uint64_t>(p.second.num_iters_for_one_second * scaling);
        if (0 == num_iters) {
            num_iters = 1;
        }
        State state(p.first, num_evals, num_iters, printer);
        if (!is_list_only) {
            p.second.func(state);
        }
        printer.result(state);
    }

    printer.footer();
}
Ejemplo n.º 2
0
void benchmark::BenchRunner::RunAll(Printer& printer, uint64_t num_evals, double scaling, const std::string& filter, bool is_list_only)
{
    if (!std::ratio_less_equal<benchmark::clock::period, std::micro>::value) {
        std::cerr << "WARNING: Clock precision is worse than microsecond - benchmarks may be less accurate!\n";
    }
#ifdef DEBUG
    std::cerr << "WARNING: This is a debug build - may result in slower benchmarks.\n";
#endif

    std::regex reFilter(filter);
    std::smatch baseMatch;

    printer.header();

    for (const auto& p : benchmarks()) {
        TestingSetup test{CBaseChainParams::REGTEST};
        {
            assert(::chainActive.Height() == 0);
            const bool witness_enabled{IsWitnessEnabled(::chainActive.Tip(), Params().GetConsensus())};
            assert(witness_enabled);
        }

        if (!std::regex_match(p.first, baseMatch, reFilter)) {
            continue;
        }

        uint64_t num_iters = static_cast<uint64_t>(p.second.num_iters_for_one_second * scaling);
        if (0 == num_iters) {
            num_iters = 1;
        }
        State state(p.first, num_evals, num_iters, printer);
        if (!is_list_only) {
            p.second.func(state);
        }
        printer.result(state);
    }

    printer.footer();
}