| 6360 | |
| 6361 | template <typename logger_type_> |
| 6362 | static void logging(bm::State &state) { |
| 6363 | struct { |
| 6364 | int code; |
| 6365 | std::string_view message; |
| 6366 | } errors[3] = { |
| 6367 | {1, "Operation not permitted"sv}, |
| 6368 | {12, "Cannot allocate memory"sv}, |
| 6369 | {113, "No route to host"sv}, |
| 6370 | }; |
| 6371 | char buffer[1024]; |
| 6372 | logger_type_ logger; |
| 6373 | std::size_t iteration_index = 0; |
| 6374 | std::size_t bytes_logged = 0; |
| 6375 | for (auto _ : state) { |
| 6376 | bytes_logged += logger( // |
| 6377 | buffer, sizeof(buffer), // |
| 6378 | std::source_location::current(), // |
| 6379 | errors[iteration_index % 3].code, errors[iteration_index % 3].message); |
| 6380 | iteration_index++; |
| 6381 | } |
| 6382 | state.SetBytesProcessed(bytes_logged); |
| 6383 | } |
| 6384 | |
| 6385 | struct log_printf_t { |
| 6386 | std::size_t operator()( // |
nothing calls this directly
no outgoing calls
no test coverage detected