Browse Source

test: match cpu core number automatically

legacy
Dnomd343 2 years ago
parent
commit
ecb9bb952e
  1. 9
      test/global/global_utils.cc

9
test/global/global_utils.cc

@ -1,5 +1,8 @@
#include <thread>
#include "global_utils.h" #include "global_utils.h"
const static uint32_t DEFAULT_THREAD_NUM = 1;
range_split_t range_split(uint64_t start, uint64_t end, uint64_t size) { range_split_t range_split(uint64_t start, uint64_t end, uint64_t size) {
uint64_t rear = end - (end - start) % size; // (rear - start) % size == 0 uint64_t rear = end - (end - start) % size; // (rear - start) % size == 0
range_split_t ranges; range_split_t ranges;
@ -13,8 +16,6 @@ range_split_t range_split(uint64_t start, uint64_t end, uint64_t size) {
} }
uint32_t thread_num() { uint32_t thread_num() {
auto num = std::thread::hardware_concurrency(); // CPU core number
// TODO: use CPU core number return (num == 0) ? DEFAULT_THREAD_NUM : num; // fetch failed -> use default number
return 16;
} }

Loading…
Cancel
Save