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

Method Run

phxqueue/comm/utils/benchmark_util.cpp:154–176  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

152}
153
154void BenchMark::Run()
155{
156 printf("qps: %d\n", impl_->qps);
157 printf("nthread: %d\n", impl_->nthread);
158 printf("nroutine: %d\n", impl_->nroutine);
159 printf("routine_sleep_time(ms): %d\n", impl_->routine_sleep_time_ms);
160 printf("start run...\n");
161
162 impl_->stats.reset(new StatData[impl_->nthread]);
163
164 for (int i{0}; i < impl_->nthread; ++i) {
165 pthread_t tid;
166 pthread_create(&tid, 0, ThreadRunFunc, new ThreadRunFuncArgs_t{i, this});
167 pthread_detach(tid);
168 }
169
170 // stat
171 gettimeofday(&impl_->last_stat_time, nullptr);
172 while (true) {
173 std::this_thread::sleep_for(std::chrono::seconds(10));
174 ResStat();
175 }
176}
177
178int BenchMark::GetRoutineSleepTimeMS() {
179 return impl_->routine_sleep_time_ms;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected