MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / BM_Sequential

Function BM_Sequential

tensorflow/core/lib/core/threadpool_test.cc:213–231  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

211}
212
213static void BM_Sequential(int iters) {
214 ThreadPool pool(Env::Default(), "test", kNumThreads);
215 // Decrement count sequentially until 0.
216 int count = iters;
217 mutex done_lock;
218 bool done_flag = false;
219 std::function<void()> work = [&pool, &count, &done_lock, &done_flag,
220 &work]() {
221 if (count--) {
222 pool.Schedule(work);
223 } else {
224 mutex_lock l(done_lock);
225 done_flag = true;
226 }
227 };
228 work();
229 mutex_lock l(done_lock);
230 done_lock.Await(Condition(&done_flag));
231}
232BENCHMARK(BM_Sequential);
233
234static void BM_Parallel(int iters) {

Callers

nothing calls this directly

Calls 4

DefaultFunction · 0.85
ConditionClass · 0.85
ScheduleMethod · 0.45
AwaitMethod · 0.45

Tested by

no test coverage detected