diff --git a/lib/OperatingSystems/FreeBSD.php b/lib/OperatingSystems/FreeBSD.php index db736eb8..44013840 100644 --- a/lib/OperatingSystems/FreeBSD.php +++ b/lib/OperatingSystems/FreeBSD.php @@ -62,12 +62,12 @@ public function getCpuName(): string { try { $model = $this->executeCommand('/sbin/sysctl -n hw.model'); - $cores = $this->executeCommand('/sbin/sysctl -n kern.smp.cpus'); + $threads = $this->executeCommand('/sbin/sysctl -n kern.smp.cpus'); - if ((int)$cores === 1) { - $data = $model . ' (1 core)'; + if ((int)$threads === 1) { + $data = $model . ' (1 thread)'; } else { - $data = $model . ' (' . $cores . ' cores)'; + $data = $model . ' (' . $threads . ' threads)'; } } catch (RuntimeException $e) { return $data; diff --git a/lib/OperatingSystems/Linux.php b/lib/OperatingSystems/Linux.php index 34440347..4e17795b 100644 --- a/lib/OperatingSystems/Linux.php +++ b/lib/OperatingSystems/Linux.php @@ -95,12 +95,12 @@ public function getCpuName(): string { $pattern = '/processor\s+:\s(.+)/'; preg_match_all($pattern, $cpuinfo, $matches); - $cores = count($matches[1]); + $threads = count($matches[1]); - if ($cores === 1) { - $data = $model . ' (1 core)'; + if ($threads === 1) { + $data = $model . ' (1 thread)'; } else { - $data = $model . ' (' . $cores . ' cores)'; + $data = $model . ' (' . $threads . ' threads)'; } return $data; diff --git a/tests/lib/LinuxTest.php b/tests/lib/LinuxTest.php index 38361374..e3b9422f 100644 --- a/tests/lib/LinuxTest.php +++ b/tests/lib/LinuxTest.php @@ -68,7 +68,7 @@ public function testGetCpuName(): void { ->with('/proc/cpuinfo') ->willReturn(file_get_contents(__DIR__ . '/../data/linux_cpuinfo')); - $this->assertEquals('Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz (4 cores)', $this->os->getCpuName()); + $this->assertEquals('Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz (4 threads)', $this->os->getCpuName()); } public function testGetCpuNameOneCore(): void { @@ -76,7 +76,7 @@ public function testGetCpuNameOneCore(): void { ->with('/proc/cpuinfo') ->willReturn(file_get_contents(__DIR__ . '/../data/linux_cpuinfo_one_core')); - $this->assertEquals('Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz (1 core)', $this->os->getCpuName()); + $this->assertEquals('Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz (1 thread)', $this->os->getCpuName()); } public function testGetCpuNamePi3b(): void { @@ -84,7 +84,7 @@ public function testGetCpuNamePi3b(): void { ->with('/proc/cpuinfo') ->willReturn(file_get_contents(__DIR__ . '/../data/linux_cpuinfo_pi3b')); - $this->assertEquals('Raspberry Pi 3 Model B Rev 1.2 (4 cores)', $this->os->getCpuName()); + $this->assertEquals('Raspberry Pi 3 Model B Rev 1.2 (4 threads)', $this->os->getCpuName()); } public function testGetCpuNamePi4b(): void { @@ -92,7 +92,7 @@ public function testGetCpuNamePi4b(): void { ->with('/proc/cpuinfo') ->willReturn(file_get_contents(__DIR__ . '/../data/linux_cpuinfo_pi4b')); - $this->assertEquals('Raspberry Pi 4 Model B Rev 1.2 (4 cores)', $this->os->getCpuName()); + $this->assertEquals('Raspberry Pi 4 Model B Rev 1.2 (4 threads)', $this->os->getCpuName()); } public function testGetCpuNameOpenPower(): void { @@ -100,7 +100,7 @@ public function testGetCpuNameOpenPower(): void { ->with('/proc/cpuinfo') ->willReturn(file_get_contents(__DIR__ . '/../data/linux_cpuinfo_openpower')); - $this->assertEquals('POWER9, altivec supported (176 cores)', $this->os->getCpuName()); + $this->assertEquals('POWER9, altivec supported (176 threads)', $this->os->getCpuName()); } public function testGetCpuNameNoData(): void {