| 200 | BENCHMARK(UserInfo); |
| 201 | |
| 202 | static void C0Control(benchmark::State& state) { |
| 203 | for (auto _ : state) { |
| 204 | for (std::string& url_string : examples) { |
| 205 | benchmark::DoNotOptimize(ada::unicode::percent_encode( |
| 206 | url_string, ada::character_sets::C0_CONTROL_PERCENT_ENCODE)); |
| 207 | } |
| 208 | } |
| 209 | if (collector.has_events()) { |
| 210 | counters::event_aggregate aggregate{}; |
| 211 | for (size_t i = 0; i < N; i++) { |
| 212 | std::atomic_thread_fence(std::memory_order_acquire); |
| 213 | collector.start(); |
| 214 | for (std::string& url_string : examples) { |
| 215 | benchmark::DoNotOptimize(ada::unicode::percent_encode( |
| 216 | url_string, ada::character_sets::C0_CONTROL_PERCENT_ENCODE)); |
| 217 | } |
| 218 | std::atomic_thread_fence(std::memory_order_release); |
| 219 | counters::event_count allocate_count = collector.end(); |
| 220 | aggregate << allocate_count; |
| 221 | } |
| 222 | state.counters["instructions/url"] = |
| 223 | aggregate.best.instructions() / std::size(examples); |
| 224 | state.counters["instructions/cycle"] = |
| 225 | aggregate.total.instructions() / aggregate.total.cycles(); |
| 226 | state.counters["instructions/byte"] = |
| 227 | aggregate.best.instructions() / examples_bytes; |
| 228 | state.counters["GHz"] = |
| 229 | aggregate.total.cycles() / aggregate.total.elapsed_ns(); |
| 230 | } |
| 231 | state.counters["time/byte"] = benchmark::Counter( |
| 232 | examples_bytes, benchmark::Counter::kIsIterationInvariantRate | |
| 233 | benchmark::Counter::kInvert); |
| 234 | state.counters["time/url"] = |
| 235 | benchmark::Counter(double(std::size(examples)), |
| 236 | benchmark::Counter::kIsIterationInvariantRate | |
| 237 | benchmark::Counter::kInvert); |
| 238 | state.counters["speed"] = benchmark::Counter( |
| 239 | examples_bytes, benchmark::Counter::kIsIterationInvariantRate); |
| 240 | state.counters["url/s"] = |
| 241 | benchmark::Counter(double(std::size(examples)), |
| 242 | benchmark::Counter::kIsIterationInvariantRate); |
| 243 | } |
| 244 | BENCHMARK(C0Control); |
| 245 | |
| 246 | int main(int argc, char** argv) { |
nothing calls this directly
no test coverage detected