| 869 | } |
| 870 | |
| 871 | bool RegisterBenchmarks() { |
| 872 | const std::vector<BenchmarkConfig> initialization_configs = |
| 873 | BuildBenchmarkConfigs(InitializationConfigs()); |
| 874 | for (const BenchmarkConfig& config : initialization_configs) { |
| 875 | benchmark::RegisterBenchmark( |
| 876 | ("BM_Initialization/" + config.name).c_str(), |
| 877 | [config](benchmark::State& state) { BM_Initialization(state, config); }) |
| 878 | ->Unit(benchmark::kMicrosecond); |
| 879 | } |
| 880 | |
| 881 | const std::vector<BenchmarkConfig> conversion_configs = |
| 882 | BuildBenchmarkConfigs(ConversionConfigs()); |
| 883 | for (const BenchmarkConfig& config : conversion_configs) { |
| 884 | benchmark::RegisterBenchmark( |
| 885 | ("BM_ConvertLongText/" + config.name).c_str(), |
| 886 | [config](benchmark::State& state) { BM_ConvertLongText(state, config); }) |
| 887 | ->Unit(benchmark::kMillisecond); |
| 888 | } |
| 889 | |
| 890 | for (const BenchmarkConfig& config : conversion_configs) { |
| 891 | for (const int iteration : {100, 1000, 10000, 100000}) { |
| 892 | benchmark::RegisterBenchmark( |
| 893 | ("BM_Convert/" + config.name + "/" + std::to_string(iteration)) |
| 894 | .c_str(), |
| 895 | [config, iteration](benchmark::State& state) { |
| 896 | BM_Convert(state, config, iteration); |
| 897 | }) |
| 898 | ->Unit(benchmark::kMillisecond); |
| 899 | } |
| 900 | } |
| 901 | |
| 902 | for (const BenchmarkConfig& config : conversion_configs) { |
| 903 | benchmark::RegisterBenchmark( |
| 904 | ("BM_CommandLineLongText/" + config.name).c_str(), |
| 905 | [config](benchmark::State& state) { |
| 906 | BM_CommandLineLongText(state, config); |
| 907 | }) |
| 908 | ->Unit(benchmark::kMillisecond) |
| 909 | ->MinTime(0.01); |
| 910 | } |
| 911 | |
| 912 | for (const BenchmarkConfig& config : conversion_configs) { |
| 913 | for (const int iteration : {100, 1000, 10000, 100000}) { |
| 914 | benchmark::RegisterBenchmark( |
| 915 | ("BM_CommandLine/" + config.name + "/" + std::to_string(iteration)) |
| 916 | .c_str(), |
| 917 | [config, iteration](benchmark::State& state) { |
| 918 | BM_CommandLine(state, config, iteration); |
| 919 | }) |
| 920 | ->Unit(benchmark::kMillisecond) |
| 921 | ->MinTime(0.01); |
| 922 | } |
| 923 | } |
| 924 | return true; |
| 925 | } |
| 926 | |
| 927 | const bool kBenchmarksRegistered = RegisterBenchmarks(); |
| 928 |
no test coverage detected