Fix ARM /proc/cpuinfo parsing.
Also fix related warning message typos.
diff --git a/src/console_reporter.cc b/src/console_reporter.cc
index bee3c85..092936d 100644
--- a/src/console_reporter.cc
+++ b/src/console_reporter.cc
@@ -37,7 +37,7 @@
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/src/csv_reporter.cc b/src/csv_reporter.cc
index a836943..d78a9df 100644
--- a/src/csv_reporter.cc
+++ b/src/csv_reporter.cc
@@ -34,7 +34,7 @@
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/src/sysinfo.cc b/src/sysinfo.cc
index d1f3120..e10e19d 100644
--- a/src/sysinfo.cc
+++ b/src/sysinfo.cc
@@ -174,12 +174,16 @@
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 @@
} 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;