diff --git a/src/bench/bench.cpp b/src/bench/bench.cpp index 9d42e10ed..11182a8e0 100644 --- a/src/bench/bench.cpp +++ b/src/bench/bench.cpp @@ -1,84 +1,85 @@ // Copyright (c) 2015-2019 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include #include +#include #include #include #include namespace { void GenerateTemplateResults( const std::vector &benchmarkResults, const std::string &filename, const char *tpl) { if (benchmarkResults.empty() || filename.empty()) { // nothing to write, bail out return; } - std::ofstream fout(filename); + fsbridge::ofstream fout{fs::PathFromString(filename)}; if (fout.is_open()) { ankerl::nanobench::render(tpl, benchmarkResults, fout); } else { std::cout << "Could write to file '" << filename << "'" << std::endl; } std::cout << "Created '" << filename << "'" << std::endl; } } // namespace benchmark::BenchRunner::BenchmarkMap &benchmark::BenchRunner::benchmarks() { static std::map benchmarks_map; return benchmarks_map; } benchmark::BenchRunner::BenchRunner(std::string name, benchmark::BenchFunction func) { benchmarks().insert(std::make_pair(name, func)); } void benchmark::BenchRunner::RunAll(const Args &args) { std::regex reFilter(args.regex_filter); std::smatch baseMatch; std::vector benchmarkResults; for (const auto &p : benchmarks()) { if (!std::regex_match(p.first, baseMatch, reFilter)) { continue; } if (args.is_list_only) { std::cout << p.first << std::endl; continue; } Bench bench; bench.name(p.first); if (args.asymptote.empty()) { p.second(bench); } else { for (auto n : args.asymptote) { bench.complexityN(n); p.second(bench); } std::cout << bench.complexityBigO() << std::endl; } benchmarkResults.push_back(bench.results().back()); } GenerateTemplateResults( benchmarkResults, args.output_csv, "# Benchmark, evals, iterations, total, min, max, median\n" "{{#result}}{{name}}, {{epochs}}, {{average(iterations)}}, " "{{sumProduct(iterations, elapsed)}}, {{minimum(elapsed)}}, " "{{maximum(elapsed)}}, {{median(elapsed)}}\n" "{{/result}}"); GenerateTemplateResults(benchmarkResults, args.output_json, ankerl::nanobench::templates::json()); } diff --git a/src/bitcoin-tx.cpp b/src/bitcoin-tx.cpp index cf9cbac6d..5825e80d9 100644 --- a/src/bitcoin-tx.cpp +++ b/src/bitcoin-tx.cpp @@ -1,895 +1,896 @@ // Copyright (c) 2009-2019 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #if defined(HAVE_CONFIG_H) #include #endif #include #include #include #include #include #include +#include #include #include #include #include