| 334 | class SparseBench { |
| 335 | public: |
| 336 | SparseBench(size_t threads, size_t bench_secs, size_t batch_count, |
| 337 | FilterMode filter_mode) |
| 338 | : threads_(threads), |
| 339 | bench_secs_(bench_secs), |
| 340 | batch_count_(batch_count), |
| 341 | filter_mode_{filter_mode} { |
| 342 | if (threads_ == 0) { |
| 343 | pool_ = make_shared<ThreadPool>(); |
| 344 | threads_ = pool_->count(); |
| 345 | cout << "Using cpu count as thread pool count[" << threads_ << "]" |
| 346 | << endl; |
| 347 | } else { |
| 348 | pool_ = make_shared<ThreadPool>(threads_, false); |
| 349 | threads_ = pool_->count(); |
| 350 | cout << "Using thread pool count[" << threads_ << "]" << endl; |
| 351 | } |
| 352 | if (batch_count_ < 1) { |
| 353 | batch_count_ = 1; |
| 354 | } |
| 355 | } |
| 356 | |
| 357 | static void stop(int signo) { |
| 358 | if (stop_now) { |