| 442 | } |
| 443 | |
| 444 | void run(core_interface::Index::Pointer index, |
| 445 | core_interface::BaseIndexQueryParam::Pointer query_param, |
| 446 | int max_iter, int topk) { |
| 447 | // Check |
| 448 | if (batch_sparse_counts_.size() == 0) { |
| 449 | return; |
| 450 | } |
| 451 | |
| 452 | query_param_ = query_param; |
| 453 | query_param_->topk = topk; |
| 454 | query_param_->is_linear = false; |
| 455 | |
| 456 | // Do bench |
| 457 | signal(SIGINT, stop); |
| 458 | bench_result_.mark_start(); |
| 459 | auto start_time = Monotime::MilliSeconds(); |
| 460 | for (size_t i = 0; i < threads_; ++i) { |
| 461 | pool_->execute(this, &SparseBench<T>::start_bench, index, max_iter, |
| 462 | &STOP_NOW); |
| 463 | } |
| 464 | |
| 465 | while (!pool_->is_finished()) { |
| 466 | this_thread::sleep_for(chrono::milliseconds(1)); |
| 467 | if (Monotime::MilliSeconds() - start_time > bench_secs_ * 1000) { |
| 468 | STOP_NOW = true; |
| 469 | } |
| 470 | } |
| 471 | |
| 472 | pool_->wait_finish(); |
| 473 | |
| 474 | bench_result_.mark_end(); |
| 475 | bench_result_.print(); |
| 476 | } |
| 477 | |
| 478 | void set_tag_lists(const std::vector<std::vector<uint64_t>> &id_to_tags_list, |
| 479 | const std::vector<uint64_t> &tag_key_list) { |
nothing calls this directly
no test coverage detected