Skip to content

Commit ddfde76

Browse files
Merge pull request #660 from nextcloud/backport/658/stable29
2 parents 9d8255d + adaed7a commit ddfde76

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

lib/OperatingSystems/FreeBSD.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,12 @@ public function getCpuName(): string {
7878

7979
try {
8080
$model = $this->executeCommand('/sbin/sysctl -n hw.model');
81-
$cores = $this->executeCommand('/sbin/sysctl -n kern.smp.cpus');
81+
$threads = $this->executeCommand('/sbin/sysctl -n kern.smp.cpus');
8282

83-
if ((int)$cores === 1) {
84-
$data = $model . ' (1 core)';
83+
if ((int)$threads === 1) {
84+
$data = $model . ' (1 thread)';
8585
} else {
86-
$data = $model . ' (' . $cores . ' cores)';
86+
$data = $model . ' (' . $threads . ' threads)';
8787
}
8888
} catch (RuntimeException $e) {
8989
return $data;

lib/OperatingSystems/Linux.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,12 @@ public function getCpuName(): string {
109109
$pattern = '/processor\s+:\s(.+)/';
110110

111111
preg_match_all($pattern, $cpuinfo, $matches);
112-
$cores = count($matches[1]);
112+
$threads = count($matches[1]);
113113

114-
if ($cores === 1) {
115-
$data = $model . ' (1 core)';
114+
if ($threads === 1) {
115+
$data = $model . ' (1 thread)';
116116
} else {
117-
$data = $model . ' (' . $cores . ' cores)';
117+
$data = $model . ' (' . $threads . ' threads)';
118118
}
119119

120120
return $data;

tests/lib/LinuxTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,39 +85,39 @@ public function testGetCpuName(): void {
8585
->with('/proc/cpuinfo')
8686
->willReturn(file_get_contents(__DIR__ . '/../data/linux_cpuinfo'));
8787

88-
$this->assertEquals('Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz (4 cores)', $this->os->getCpuName());
88+
$this->assertEquals('Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz (4 threads)', $this->os->getCpuName());
8989
}
9090

9191
public function testGetCpuNameOneCore(): void {
9292
$this->os->method('readContent')
9393
->with('/proc/cpuinfo')
9494
->willReturn(file_get_contents(__DIR__ . '/../data/linux_cpuinfo_one_core'));
9595

96-
$this->assertEquals('Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz (1 core)', $this->os->getCpuName());
96+
$this->assertEquals('Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz (1 thread)', $this->os->getCpuName());
9797
}
9898

9999
public function testGetCpuNamePi3b(): void {
100100
$this->os->method('readContent')
101101
->with('/proc/cpuinfo')
102102
->willReturn(file_get_contents(__DIR__ . '/../data/linux_cpuinfo_pi3b'));
103103

104-
$this->assertEquals('Raspberry Pi 3 Model B Rev 1.2 (4 cores)', $this->os->getCpuName());
104+
$this->assertEquals('Raspberry Pi 3 Model B Rev 1.2 (4 threads)', $this->os->getCpuName());
105105
}
106106

107107
public function testGetCpuNamePi4b(): void {
108108
$this->os->method('readContent')
109109
->with('/proc/cpuinfo')
110110
->willReturn(file_get_contents(__DIR__ . '/../data/linux_cpuinfo_pi4b'));
111111

112-
$this->assertEquals('Raspberry Pi 4 Model B Rev 1.2 (4 cores)', $this->os->getCpuName());
112+
$this->assertEquals('Raspberry Pi 4 Model B Rev 1.2 (4 threads)', $this->os->getCpuName());
113113
}
114114

115115
public function testGetCpuNameOpenPower(): void {
116116
$this->os->method('readContent')
117117
->with('/proc/cpuinfo')
118118
->willReturn(file_get_contents(__DIR__ . '/../data/linux_cpuinfo_openpower'));
119119

120-
$this->assertEquals('POWER9, altivec supported (176 cores)', $this->os->getCpuName());
120+
$this->assertEquals('POWER9, altivec supported (176 threads)', $this->os->getCpuName());
121121
}
122122

123123
public function testGetCpuNameNoData(): void {

0 commit comments

Comments
 (0)