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

Method run

tools/core/bench_original.cc:471–498  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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