// On Linux, the number of physical cores can be computed from /proc/cpuinfo,
// using the number of unique physical/core id pairs. The following
// implementation reads the /proc/cpuinfo format on an x86_64 system.
-int computeHostNumPhysicalCores() {
+static int computeHostNumPhysicalCores() {
// Enabled represents the number of physical id/core id pairs with at least
// one processor id enabled by the CPU affinity mask.
cpu_set_t Affinity, Enabled;
return CPU_COUNT(&Enabled);
}
#elif defined(__linux__) && defined(__s390x__)
-int computeHostNumPhysicalCores() { return sysconf(_SC_NPROCESSORS_ONLN); }
+static int computeHostNumPhysicalCores() {
+ return sysconf(_SC_NPROCESSORS_ONLN);
+}
#elif defined(__linux__) && !defined(__ANDROID__)
-int computeHostNumPhysicalCores() {
+static int computeHostNumPhysicalCores() {
cpu_set_t Affinity;
if (sched_getaffinity(0, sizeof(Affinity), &Affinity) == 0)
return CPU_COUNT(&Affinity);
}
#elif defined(__APPLE__)
// Gets the number of *physical cores* on the machine.
-int computeHostNumPhysicalCores() {
+static int computeHostNumPhysicalCores() {
uint32_t count;
size_t len = sizeof(count);
sysctlbyname("hw.physicalcpu", &count, &len, NULL, 0);
return count;
}
#elif defined(__MVS__)
-int computeHostNumPhysicalCores() {
+static int computeHostNumPhysicalCores() {
enum {
// Byte offset of the pointer to the Communications Vector Table (CVT) in
// the Prefixed Save Area (PSA). The table entry is a 31-bit pointer and