summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/benchmark/src
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/benchmark/src')
-rw-r--r--3rdparty/benchmark/src/benchmark.cc6
-rw-r--r--3rdparty/benchmark/src/console_reporter.cc2
-rw-r--r--3rdparty/benchmark/src/csv_reporter.cc2
-rw-r--r--3rdparty/benchmark/src/cycleclock.h8
-rw-r--r--3rdparty/benchmark/src/sysinfo.cc16
5 files changed, 24 insertions, 10 deletions
diff --git a/3rdparty/benchmark/src/benchmark.cc b/3rdparty/benchmark/src/benchmark.cc
index 269b7978023..08b180e37e6 100644
--- a/3rdparty/benchmark/src/benchmark.cc
+++ b/3rdparty/benchmark/src/benchmark.cc
@@ -599,7 +599,7 @@ namespace {
void RunInThread(const benchmark::internal::Benchmark::Instance* b,
size_t iters, int thread_id,
ThreadStats* total) EXCLUDES(GetBenchmarkLock()) {
- State st(iters, b->has_arg1, b->arg1, b->has_arg2, b->arg2, thread_id);
+ State st(iters, b->has_arg1, b->arg1, b->has_arg2, b->arg2, thread_id, b->threads);
b->benchmark->Run(st);
CHECK(st.iterations() == st.max_iterations) <<
"Benchmark returned before State::KeepRunning() returned false!";
@@ -736,15 +736,17 @@ void RunBenchmark(const benchmark::internal::Benchmark::Instance& b,
} // namespace
State::State(size_t max_iters, bool has_x, int x, bool has_y, int y,
- int thread_i)
+ int thread_i, int n_threads)
: started_(false), total_iterations_(0),
has_range_x_(has_x), range_x_(x),
has_range_y_(has_y), range_y_(y),
bytes_processed_(0), items_processed_(0),
thread_index(thread_i),
+ threads(n_threads),
max_iterations(max_iters)
{
CHECK(max_iterations != 0) << "At least one iteration must be run";
+ CHECK_LT(thread_index, threads) << "thread_index must be less than threads";
}
void State::PauseTiming() {
diff --git a/3rdparty/benchmark/src/console_reporter.cc b/3rdparty/benchmark/src/console_reporter.cc
index bee3c8576c0..092936d5935 100644
--- a/3rdparty/benchmark/src/console_reporter.cc
+++ b/3rdparty/benchmark/src/console_reporter.cc
@@ -37,7 +37,7 @@ bool ConsoleReporter::ReportContext(const Context& context) {
if (context.cpu_scaling_enabled) {
std::cerr << "***WARNING*** CPU scaling is enabled, the benchmark "
- "real time measurements may be noisy and will incure extra "
+ "real time measurements may be noisy and will incur extra "
"overhead.\n";
}
diff --git a/3rdparty/benchmark/src/csv_reporter.cc b/3rdparty/benchmark/src/csv_reporter.cc
index a83694338bd..d78a9dfb267 100644
--- a/3rdparty/benchmark/src/csv_reporter.cc
+++ b/3rdparty/benchmark/src/csv_reporter.cc
@@ -34,7 +34,7 @@ bool CSVReporter::ReportContext(const Context& context) {
if (context.cpu_scaling_enabled) {
std::cerr << "***WARNING*** CPU scaling is enabled, the benchmark "
- "real time measurements may be noisy and will incure extra "
+ "real time measurements may be noisy and will incur extra "
"overhead.\n";
}
diff --git a/3rdparty/benchmark/src/cycleclock.h b/3rdparty/benchmark/src/cycleclock.h
index 42541dafc88..3110804634c 100644
--- a/3rdparty/benchmark/src/cycleclock.h
+++ b/3rdparty/benchmark/src/cycleclock.h
@@ -99,6 +99,14 @@ inline BENCHMARK_ALWAYS_INLINE int64_t Now() {
_asm rdtsc
#elif defined(COMPILER_MSVC)
return __rdtsc();
+#elif defined(__aarch64__)
+ // System timer of ARMv8 runs at a different frequency than the CPU's.
+ // The frequency is fixed, typically in the range 1-50MHz. It can be
+ // read at CNTFRQ special register. We assume the OS has set up
+ // the virtual timer properly.
+ int64_t virtual_timer_value;
+ asm volatile("mrs %0, cntvct_el0" : "=r"(virtual_timer_value));
+ return virtual_timer_value;
#elif defined(__ARM_ARCH)
#if (__ARM_ARCH >= 6) // V6 is the earliest arch that has a standard cyclecount
uint32_t pmccntr;
diff --git a/3rdparty/benchmark/src/sysinfo.cc b/3rdparty/benchmark/src/sysinfo.cc
index d1f312024d3..e10e19df086 100644
--- a/3rdparty/benchmark/src/sysinfo.cc
+++ b/3rdparty/benchmark/src/sysinfo.cc
@@ -174,12 +174,16 @@ void InitializeSystemInfo() {
if (freqstr[1] != '\0' && *err == '\0' && bogo_clock > 0)
saw_bogo = true;
}
- } else if (strncasecmp(line, "processor", sizeof("processor") - 1) == 0) {
+ } else if (strncmp(line, "processor", sizeof("processor") - 1) == 0) {
+ // The above comparison is case-sensitive because ARM kernels often
+ // include a "Processor" line that tells you about the CPU, distinct
+ // from the usual "processor" lines that give you CPU ids. No current
+ // Linux architecture is using "Processor" for CPU ids.
num_cpus++; // count up every time we see an "processor :" entry
- const char* freqstr = strchr(line, ':');
- if (freqstr) {
- const long cpu_id = strtol(freqstr + 1, &err, 10);
- if (freqstr[1] != '\0' && *err == '\0' && max_cpu_id < cpu_id)
+ const char* id_str = strchr(line, ':');
+ if (id_str) {
+ const long cpu_id = strtol(id_str + 1, &err, 10);
+ if (id_str[1] != '\0' && *err == '\0' && max_cpu_id < cpu_id)
max_cpu_id = cpu_id;
}
}
@@ -201,7 +205,7 @@ void InitializeSystemInfo() {
} else {
if ((max_cpu_id + 1) != num_cpus) {
fprintf(stderr,
- "CPU ID assignments in /proc/cpuinfo seems messed up."
+ "CPU ID assignments in /proc/cpuinfo seem messed up."
" This is usually caused by a bad BIOS.\n");
}
cpuinfo_num_cpus = num_cpus;