Changeset View
Changeset View
Standalone View
Standalone View
src/bench/bench_bitcoin.cpp
// Copyright (c) 2015-2016 The Bitcoin Core developers | // Copyright (c) 2015-2016 The Bitcoin Core developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#include <bench/bench.h> | #include <bench/bench.h> | ||||
#include <crypto/sha256.h> | #include <crypto/sha256.h> | ||||
#include <key.h> | #include <key.h> | ||||
#include <random.h> | #include <random.h> | ||||
#include <util.h> | #include <util.h> | ||||
#include <utilstrencodings.h> | |||||
#include <validation.h> | #include <validation.h> | ||||
#include <boost/lexical_cast.hpp> | |||||
#include <memory> | #include <memory> | ||||
static const int64_t DEFAULT_BENCH_EVALUATIONS = 5; | static const int64_t DEFAULT_BENCH_EVALUATIONS = 5; | ||||
static const char *DEFAULT_BENCH_FILTER = ".*"; | static const char *DEFAULT_BENCH_FILTER = ".*"; | ||||
static const char *DEFAULT_BENCH_SCALING = "1.0"; | static const char *DEFAULT_BENCH_SCALING = "1.0"; | ||||
static const char *DEFAULT_BENCH_PRINTER = "console"; | static const char *DEFAULT_BENCH_PRINTER = "console"; | ||||
static const char *DEFAULT_PLOT_PLOTLYURL = | static const char *DEFAULT_PLOT_PLOTLYURL = | ||||
"https://cdn.plot.ly/plotly-latest.min.js"; | "https://cdn.plot.ly/plotly-latest.min.js"; | ||||
▲ Show 20 Lines • Show All 69 Lines • ▼ Show 20 Lines | int main(int argc, char **argv) { | ||||
// don't want to write to debug.log file | // don't want to write to debug.log file | ||||
GetLogger().m_print_to_file = false; | GetLogger().m_print_to_file = false; | ||||
int64_t evaluations = gArgs.GetArg("-evals", DEFAULT_BENCH_EVALUATIONS); | int64_t evaluations = gArgs.GetArg("-evals", DEFAULT_BENCH_EVALUATIONS); | ||||
std::string regex_filter = gArgs.GetArg("-filter", DEFAULT_BENCH_FILTER); | std::string regex_filter = gArgs.GetArg("-filter", DEFAULT_BENCH_FILTER); | ||||
std::string scaling_str = gArgs.GetArg("-scaling", DEFAULT_BENCH_SCALING); | std::string scaling_str = gArgs.GetArg("-scaling", DEFAULT_BENCH_SCALING); | ||||
bool is_list_only = gArgs.GetBoolArg("-list", false); | bool is_list_only = gArgs.GetBoolArg("-list", false); | ||||
double scaling_factor = boost::lexical_cast<double>(scaling_str); | double scaling_factor; | ||||
if (!ParseDouble(scaling_str, &scaling_factor)) { | |||||
fprintf(stderr, "Error parsing scaling factor as double: %s\n", | |||||
scaling_str.c_str()); | |||||
return EXIT_FAILURE; | |||||
} | |||||
std::unique_ptr<benchmark::Printer> printer( | std::unique_ptr<benchmark::Printer> printer( | ||||
new benchmark::ConsolePrinter()); | new benchmark::ConsolePrinter()); | ||||
std::string printer_arg = gArgs.GetArg("-printer", DEFAULT_BENCH_PRINTER); | std::string printer_arg = gArgs.GetArg("-printer", DEFAULT_BENCH_PRINTER); | ||||
if ("plot" == printer_arg) { | if ("plot" == printer_arg) { | ||||
printer.reset(new benchmark::PlotlyPrinter( | printer.reset(new benchmark::PlotlyPrinter( | ||||
gArgs.GetArg("-plot-plotlyurl", DEFAULT_PLOT_PLOTLYURL), | gArgs.GetArg("-plot-plotlyurl", DEFAULT_PLOT_PLOTLYURL), | ||||
gArgs.GetArg("-plot-width", DEFAULT_PLOT_WIDTH), | gArgs.GetArg("-plot-width", DEFAULT_PLOT_WIDTH), | ||||
Show All 10 Lines |