Move NumCPUs() into regexp_benchmark.cc.
Change-Id: Iad9429c6246a5780e2cb0f3e4f04b3b749410798
Reviewed-on: https://code-review.googlesource.com/c/re2/+/46694
Reviewed-by: Paul Wankadia <junyer@google.com>
diff --git a/re2/testing/regexp_benchmark.cc b/re2/testing/regexp_benchmark.cc
index 9af9b34..ab9bb2c 100644
--- a/re2/testing/regexp_benchmark.cc
+++ b/re2/testing/regexp_benchmark.cc
@@ -8,6 +8,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string>
+#include <thread>
#include <utility>
#include "util/test.h"
@@ -105,6 +106,11 @@
sizeof(PCRE), sizeof(RE2), sizeof(Prog), sizeof(Prog::Inst));
}
+int NumCPUs() {
+ // Pretend to support multi-threaded benchmarking.
+ return static_cast<int>(std::thread::hardware_concurrency());
+}
+
// Regular expression implementation wrappers.
// Defined at bottom of file, but they are repetitive
// and not interesting.
diff --git a/util/benchmark.cc b/util/benchmark.cc
index 8ef6b1e..0bd6a94 100644
--- a/util/benchmark.cc
+++ b/util/benchmark.cc
@@ -61,11 +61,6 @@
void SetBenchmarkItemsProcessed(int64_t i) { items = i; }
-int NumCPUs() {
- // Pretend to support multi-threaded benchmarking.
- return static_cast<int>(std::thread::hardware_concurrency());
-}
-
static void RunFunc(Benchmark* b, int iters, int arg) {
t0 = nsec();
ns = 0;
diff --git a/util/benchmark.h b/util/benchmark.h
index fb81cc4..a8b552f 100644
--- a/util/benchmark.h
+++ b/util/benchmark.h
@@ -7,7 +7,6 @@
#include <stdint.h>
#include <functional>
-#include <thread>
#include "util/logging.h"
#include "util/util.h"
@@ -19,8 +18,6 @@
void SetBenchmarkBytesProcessed(int64_t b);
void SetBenchmarkItemsProcessed(int64_t i);
-int NumCPUs();
-
namespace benchmark {
// The new benchmark API implemented as a layer over the old benchmark API.