diff --git a/src/bench/bench.cpp b/src/bench/bench.cpp index d3de4c62e4..16d622ebc0 100644 --- a/src/bench/bench.cpp +++ b/src/bench/bench.cpp @@ -18,20 +18,19 @@ const std::function G_TEST_LOG_FUN{}; namespace { -void GenerateTemplateResults(const std::vector& benchmarkResults, const std::string& filename, const char* tpl) +void GenerateTemplateResults(const std::vector& benchmarkResults, const fs::path& file, const char* tpl) { - if (benchmarkResults.empty() || filename.empty()) { + if (benchmarkResults.empty() || file.empty()) { // nothing to write, bail out return; } - std::ofstream fout{fs::PathFromString(filename)}; + std::ofstream fout{file}; if (fout.is_open()) { ankerl::nanobench::render(tpl, benchmarkResults, fout); + std::cout << "Created " << file << std::endl; } else { - std::cout << "Could write to file '" << filename << "'" << std::endl; + std::cout << "Could not write to file " << file << std::endl; } - - std::cout << "Created '" << filename << "'" << std::endl; } } // namespace diff --git a/src/bench/bench.h b/src/bench/bench.h index c4fcd80e33..6804273d52 100644 --- a/src/bench/bench.h +++ b/src/bench/bench.h @@ -5,6 +5,7 @@ #ifndef BITCOIN_BENCH_BENCH_H #define BITCOIN_BENCH_BENCH_H +#include #include #include @@ -44,8 +45,8 @@ struct Args { std::string regex_filter; bool is_list_only; std::vector asymptote; - std::string output_csv; - std::string output_json; + fs::path output_csv; + fs::path output_json; }; class BenchRunner diff --git a/src/bench/bench_bitcoin.cpp b/src/bench/bench_bitcoin.cpp index 15827a0603..07bc619bd6 100644 --- a/src/bench/bench_bitcoin.cpp +++ b/src/bench/bench_bitcoin.cpp @@ -5,6 +5,7 @@ #include #include +#include #include #include #include @@ -57,8 +58,8 @@ int main(int argc, char** argv) args.regex_filter = argsman.GetArg("-filter", DEFAULT_BENCH_FILTER); args.is_list_only = argsman.GetBoolArg("-list", false); args.asymptote = parseAsymptote(argsman.GetArg("-asymptote", "")); - args.output_csv = argsman.GetArg("-output_csv", ""); - args.output_json = argsman.GetArg("-output_json", ""); + args.output_csv = fs::PathFromString(argsman.GetArg("-output_csv", "")); + args.output_json = fs::PathFromString(argsman.GetArg("-output_json", "")); benchmark::BenchRunner::RunAll(args);