| 118 | unlink(s.c_str()); |
| 119 | } |
| 120 | void Lazy_same_read_bench(benchmark::State &state) { |
| 121 | using namespace async_simple::coro; |
| 122 | int num = state.range(0); |
| 123 | int id = 4; |
| 124 | std::string s = std::string("test.") + std::to_string(id) + ".txt"; |
| 125 | gen_file(s, id); |
| 126 | auto core_num = std::thread::hardware_concurrency(); |
| 127 | SimpleExecutor e(core_num); |
| 128 | for (auto _ : state) { |
| 129 | auto f = [&s, &e, num, core_num]() -> Lazy<void> { |
| 130 | std::vector<Lazy<void>> lazy_list; |
| 131 | lazy_list.reserve(core_num); |
| 132 | for (size_t i = 0; i < core_num; ++i) { |
| 133 | lazy_list.push_back( |
| 134 | async_read_file_for(num, s, e.getIOExecutor())); |
| 135 | } |
| 136 | co_await collectAllPara(std::move(lazy_list)); |
| 137 | co_return; |
| 138 | }; |
| 139 | syncAwait(f().via(&e)); |
| 140 | } |
| 141 | unlink(s.c_str()); |
| 142 | } |
nothing calls this directly
no test coverage detected