MCPcopy Create free account
hub / github.com/alibaba/PhotonLibOS / TEST

Function TEST

thread/test/test.cpp:174–201  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

172}
173
174TEST(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
203thread_local photon::condition_variable aConditionVariable;
204thread_local photon::mutex aMutex;

Callers

nothing calls this directly

Calls 15

sleepq_perfFunction · 0.85
thread_createFunction · 0.85
thread_yieldFunction · 0.85
thread_yield_toFunction · 0.85
test_thread_switchFunction · 0.85
timestamp_updater_initFunction · 0.85
timestamp_updater_finiFunction · 0.85
wait_for_shotFunction · 0.85
test_reuseFunction · 0.85
thread_enable_joinFunction · 0.85
thread_joinFunction · 0.85
test_threadFunction · 0.85

Tested by

no test coverage detected