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

Function do_test

thread/test/test-pooled-stack-allocator.cpp:28–39  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26static constexpr uint64_t N = 10000;
27
28void do_test(int pool_mode, const PhotonOptions& options) {
29 init(INIT_EVENT_DEFAULT, INIT_IO_NONE, options);
30 WorkPool pool(4, INIT_EVENT_DEFAULT, INIT_IO_NONE, pool_mode);
31 semaphore sem(0);
32 auto start = now;
33 for (uint64_t i = 0; i < N; i++) {
34 pool.async_call(new auto([&] { sem.signal(1); }));
35 }
36 sem.wait(N);
37 LOG_TEMP("Spent ` us", now - start);
38 fini();
39}
40/*
41TEST(Normal, NoPool) {
42 do_test(0, {});

Callers 1

TESTFunction · 0.70

Calls 5

initFunction · 0.70
finiFunction · 0.70
async_callMethod · 0.45
signalMethod · 0.45
waitMethod · 0.45

Tested by

no test coverage detected