Skip to content

Commit

Permalink
Rename HwFinder to HwLogicalFinder (#45)
Browse files Browse the repository at this point in the history
This better reflects what it does.
  • Loading branch information
theofidry authored Dec 7, 2022
1 parent 72b7d5d commit fc1cdf5
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ $cores = (new CpuCoreCounter($finders))->getCount();

```php
// Use CPUInfo first & don't use Nproc
use Fidry\CpuCoreCounter\CpuInfoFinder;use Fidry\CpuCoreCounter\HwFinder;use Fidry\CpuCoreCounter\WindowsWmicFinder;$finders = [
use Fidry\CpuCoreCounter\CpuInfoFinder;use Fidry\CpuCoreCounter\HwLogicalFinder;use Fidry\CpuCoreCounter\WindowsWmicFinder;$finders = [
new CpuInfoFinder(),
new WindowsWmicFinder(),
new HwFinder(),
new HwLogicalFinder(),
];

$cores = (new CpuCoreCounter($finders))->getCount();
Expand Down
2 changes: 1 addition & 1 deletion src/CpuCoreCounter.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public static function getDefaultFinders(): array
return [
new NProcFinder(),
new WindowsWmicFinder(),
new HwFinder(),
new HwLogicalFinder(),
new CpuInfoFinder(),
];
}
Expand Down
4 changes: 2 additions & 2 deletions src/HwFinder.php → src/HwLogicalFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
use const FILTER_VALIDATE_INT;

/**
* Find the number of CPU cores for Linux, BSD and OSX.
* Find the number of logical CPU cores for Linux, BSD and OSX.
*
* @see https://github.com/paratestphp/paratest/blob/c163539818fd96308ca8dc60f46088461e366ed4/src/Runners/PHPUnit/Options.php#L903-L909
* @see https://opensource.apple.com/source/xnu/xnu-792.2.4/libkern/libkern/sysctl.h.auto.html
*/
final class HwFinder implements CpuCoreFinder
final class HwLogicalFinder implements CpuCoreFinder
{
/**
* @return positive-int|null
Expand Down
8 changes: 4 additions & 4 deletions tests/HwFinderTest.php → tests/HwLogicalFinderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@

namespace Fidry\CpuCoreCounter\Test;

use Fidry\CpuCoreCounter\HwFinder;
use Fidry\CpuCoreCounter\HwLogicalFinder;
use PHPUnit\Framework\TestCase;

/**
* @covers \Fidry\CpuCoreCounter\HwFinder
* @covers \Fidry\CpuCoreCounter\HwLogicalFinder
*
* @internal
*/
final class HwFinderTest extends TestCase
final class HwLogicalFinderTest extends TestCase
{
/**
* @dataProvider processProvider
Expand All @@ -30,7 +30,7 @@ public function test_it_can_count_the_number_of_cpu_cores(
string $process,
?int $expected
): void {
$actual = HwFinder::countCpuCores($process);
$actual = HwLogicalFinder::countCpuCores($process);

self::assertSame($expected, $actual);
}
Expand Down

0 comments on commit fc1cdf5

Please sign in to comment.