Make NumCPUs() in util/benchmark.cc work better.
Change-Id: If7cd0485b2d4fd7209663132e8ac63102a9dedb1
Reviewed-on: https://code-review.googlesource.com/c/36450
Reviewed-by: Paul Wankadia <junyer@google.com>
diff --git a/util/benchmark.cc b/util/benchmark.cc
index 125bbe3..144f550 100644
--- a/util/benchmark.cc
+++ b/util/benchmark.cc
@@ -7,6 +7,7 @@
#include <stdlib.h>
#include <algorithm>
#include <chrono>
+#include <thread>
#include "util/util.h"
#include "util/flags.h"
@@ -67,7 +68,7 @@
}
int NumCPUs() {
- return 1;
+ return static_cast<int>(std::thread::hardware_concurrency());
}
static void runN(Benchmark *b, int n, int siz) {