| 797 | } |
| 798 | |
| 799 | static void BM_CommandLineLongText(benchmark::State& state, |
| 800 | const BenchmarkConfig& config) { |
| 801 | const std::string input_path = |
| 802 | GetTemporaryFileRegistry().Create("benchmark-cli-longtext-input", ".txt"); |
| 803 | const std::string output_path = |
| 804 | GetTemporaryFileRegistry().Create("benchmark-cli-longtext-output", ".txt"); |
| 805 | const std::string measured_path = |
| 806 | GetTemporaryFileRegistry().Create("benchmark-cli-longtext-measured", |
| 807 | ".json"); |
| 808 | const std::string text = ReadText("zuozhuan.txt"); |
| 809 | { |
| 810 | std::ofstream stream(input_path.c_str(), std::ios::binary); |
| 811 | stream << text; |
| 812 | } |
| 813 | |
| 814 | MeasuredResult measured; |
| 815 | size_t total_input_bytes = 0; |
| 816 | double total_load_ms = 0.0; |
| 817 | double total_convert_ms = 0.0; |
| 818 | double total_write_ms = 0.0; |
| 819 | double total_total_ms = 0.0; |
| 820 | for (auto _ : state) { |
| 821 | RunCommandLineConversion(config, input_path, output_path, measured_path); |
| 822 | measured = ParseMeasuredResult(measured_path); |
| 823 | total_input_bytes += measured.inputBytes == 0 ? text.size() : measured.inputBytes; |
| 824 | total_load_ms += measured.loadMs; |
| 825 | total_convert_ms += measured.convertMs; |
| 826 | total_write_ms += measured.writeMs; |
| 827 | total_total_ms += measured.totalMs; |
| 828 | } |
| 829 | SetCommandLineCounters(state, total_input_bytes, total_load_ms, |
| 830 | total_convert_ms, total_write_ms, total_total_ms); |
| 831 | } |
| 832 | |
| 833 | static void BM_CommandLine(benchmark::State& state, const BenchmarkConfig& config, |
| 834 | int iteration) { |
no test coverage detected