MCPcopy Create free account
hub / github.com/Tencent/phxqueue / ThreadRun

Method ThreadRun

phxqueue/comm/utils/benchmark_util.cpp:133–152  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

131}
132
133void BenchMark::ThreadRun(const int vtid) {
134 stCoRoutineAttr_t attr;
135 attr.stack_size = 1024 * 16;
136
137
138 std::unique_ptr<struct CoWorkerCtx_t[]> ctxs(new struct CoWorkerCtx_t[impl_->nroutine]);
139
140 for (int i{0}; i < impl_->nroutine; ++i)
141 {
142 CoWorkerCtx_t *ctx = &ctxs[i];
143 ctx->co = nullptr;
144 ctx->bm = this;
145 ctx->vtid = vtid;
146 ctx->rid = i;
147
148 co_create(&(ctx->co), &attr, RoutineRunFunc, ctx);
149 co_resume(ctx->co);
150 }
151 co_eventloop(co_get_epoll_ct(), nullptr, this);
152}
153
154void BenchMark::Run()
155{

Callers 1

ThreadRunFuncFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected