| 25 | namespace { |
| 26 | |
| 27 | void GenerateTemplateResults(const std::vector<ankerl::nanobench::Result>& benchmarkResults, const fs::path& file, const char* tpl) |
| 28 | { |
| 29 | if (benchmarkResults.empty() || file.empty()) { |
| 30 | // nothing to write, bail out |
| 31 | return; |
| 32 | } |
| 33 | std::ofstream fout{file}; |
| 34 | if (fout.is_open()) { |
| 35 | ankerl::nanobench::render(tpl, benchmarkResults, fout); |
| 36 | std::cout << "Created " << file << std::endl; |
| 37 | } else { |
| 38 | std::cout << "Could not write to file " << file << std::endl; |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | } // namespace |
| 43 | |