| 172 | } |
| 173 | |
| 174 | TEST(Sleep, queue) //Sleep_queue_Test::TestBody |
| 175 | { |
| 176 | const int heap_size = 1000000; |
| 177 | const int rand_limit = 100000000; |
| 178 | |
| 179 | auto seed = /* time(0); */10007; |
| 180 | srand(seed); |
| 181 | SleepQueue sleepq; |
| 182 | sleepq.q.reserve(heap_size); |
| 183 | vector<photon::thread*> items; |
| 184 | |
| 185 | LOG_INFO("ITEMS WITH SAME VALUE."); |
| 186 | for (int i = 0; i < heap_size; i++){ |
| 187 | auto th = new photon::thread(); |
| 188 | th->ts_wakeup = 1000;/* rand() % 100000000 */; |
| 189 | items.emplace_back(th); |
| 190 | } |
| 191 | sleepq_perf(sleepq, items); |
| 192 | |
| 193 | LOG_INFO("ITEMS WITH RANDOM VALUE."); |
| 194 | for (auto th: items) |
| 195 | th->ts_wakeup = rand() % rand_limit; |
| 196 | sleepq_perf(sleepq, items); |
| 197 | |
| 198 | LOG_INFO("sleepq test done."); |
| 199 | for (auto th : items) |
| 200 | delete th; |
| 201 | } |
| 202 | |
| 203 | thread_local photon::condition_variable aConditionVariable; |
| 204 | thread_local photon::mutex aMutex; |
nothing calls this directly
no test coverage detected