| 376 | class SparseBench { |
| 377 | public: |
| 378 | SparseBench(size_t threads, size_t bench_secs, size_t batch_count, |
| 379 | FilterMode filter_mode) |
| 380 | : threads_(threads), |
| 381 | bench_secs_(bench_secs), |
| 382 | batch_count_(batch_count), |
| 383 | filter_mode_{filter_mode} { |
| 384 | if (threads_ == 0) { |
| 385 | pool_ = make_shared<ThreadPool>(); |
| 386 | threads_ = pool_->count(); |
| 387 | cout << "Using cpu count as thread pool count[" << threads_ << "]" |
| 388 | << endl; |
| 389 | } else { |
| 390 | pool_ = make_shared<ThreadPool>(threads_, false); |
| 391 | threads_ = pool_->count(); |
| 392 | cout << "Using thread pool count[" << threads_ << "]" << endl; |
| 393 | } |
| 394 | if (batch_count_ < 1) { |
| 395 | batch_count_ = 1; |
| 396 | } |
| 397 | } |
| 398 | |
| 399 | static void stop(int signo) { |
| 400 | if (stop_now) { |