MCPcopy Create free account
hub / github.com/alibaba/zvec / run

Method run

tools/core/bench_original.cc:468–495  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

466 }
467
468 void run(SparseFlow *flower, int max_iter, int topk) {
469 for (size_t i = 0; i < threads_; i++) {
470 contexts_.emplace_back(flower->create_context());
471 contexts_[i]->set_topk(topk);
472 contexts_[i]->set_debug_mode(g_debug_mode);
473 }
474
475 // Do bench
476 signal(SIGINT, stop);
477 bench_result_.mark_start();
478 auto start_time = Monotime::MilliSeconds();
479 for (size_t i = 0; i < threads_; ++i) {
480 pool_->execute(this, &SparseBench<T>::start_bench, flower, max_iter,
481 &STOP_NOW);
482 }
483
484 while (!pool_->is_finished()) {
485 this_thread::sleep_for(chrono::milliseconds(1));
486 if (Monotime::MilliSeconds() - start_time > bench_secs_ * 1000) {
487 STOP_NOW = true;
488 }
489 }
490
491 pool_->wait_finish();
492
493 bench_result_.mark_end();
494 bench_result_.print();
495 }
496
497 private:
498 void start_bench(SparseFlow *flower, size_t max_iter, const bool *is_stop) {

Callers

nothing calls this directly

Calls 9

mark_startMethod · 0.80
mark_endMethod · 0.80
create_contextMethod · 0.45
set_topkMethod · 0.45
set_debug_modeMethod · 0.45
executeMethod · 0.45
is_finishedMethod · 0.45
wait_finishMethod · 0.45
printMethod · 0.45

Tested by

no test coverage detected