generated from ergebnis/php-package-template
-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes #58
- Loading branch information
Showing
5 changed files
with
126 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Fidry CPUCounter Config package. | ||
* | ||
* (c) Théo FIDRY <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Fidry\CpuCoreCounter\Finder; | ||
|
||
/** | ||
* Find the number of logical CPU cores for Linux and the likes. | ||
* | ||
* @see https://twitter.com/freebsdfrau/status/1052016199452700678?s=20&t=M2pHkRqmmna-UF68lfL2hw | ||
*/ | ||
final class LinuxyNProcessorFinder extends PopenBasedFinder | ||
{ | ||
protected function getCommand(): string | ||
{ | ||
return 'getconf _NPROCESSORS_ONLN'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Fidry CPUCounter Config package. | ||
* | ||
* (c) Théo FIDRY <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Fidry\CpuCoreCounter\Finder; | ||
|
||
/** | ||
* Find the number of logical CPU cores for FreeSBD, Solaris and the likes. | ||
* | ||
* @see https://twitter.com/freebsdfrau/status/1052016199452700678?s=20&t=M2pHkRqmmna-UF68lfL2hw | ||
*/ | ||
final class NProcessorFinder extends PopenBasedFinder | ||
{ | ||
protected function getCommand(): string | ||
{ | ||
return 'getconf NPROCESSORS_ONLN'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Fidry CPUCounter Config package. | ||
* | ||
* (c) Théo FIDRY <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Fidry\CpuCoreCounter\Test\Finder; | ||
|
||
use Fidry\CpuCoreCounter\Finder\LinuxyNProcessorFinder; | ||
use Fidry\CpuCoreCounter\Finder\PopenBasedFinder; | ||
|
||
/** | ||
* @covers \Fidry\CpuCoreCounter\Finder\LinuxyNProcessorFinder | ||
* | ||
* @internal | ||
*/ | ||
final class LinuxyNProcessorFinderTest extends PopenBasedFinderTestCase | ||
{ | ||
public function test_it_can_describe_itself(): void | ||
{ | ||
self::assertSame('LinuxyNProcessorFinder', $this->getFinder()->toString()); | ||
} | ||
|
||
protected function getFinder(): PopenBasedFinder | ||
{ | ||
return new LinuxyNProcessorFinder(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Fidry CPUCounter Config package. | ||
* | ||
* (c) Théo FIDRY <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Fidry\CpuCoreCounter\Test\Finder; | ||
|
||
use Fidry\CpuCoreCounter\Finder\NProcessorFinder; | ||
use Fidry\CpuCoreCounter\Finder\PopenBasedFinder; | ||
|
||
/** | ||
* @covers \Fidry\CpuCoreCounter\Finder\NProcessorFinder | ||
* | ||
* @internal | ||
*/ | ||
final class NProcessorFinderTest extends PopenBasedFinderTestCase | ||
{ | ||
public function test_it_can_describe_itself(): void | ||
{ | ||
self::assertSame('NProcessorFinder', $this->getFinder()->toString()); | ||
} | ||
|
||
protected function getFinder(): PopenBasedFinder | ||
{ | ||
return new NProcessorFinder(); | ||
} | ||
} |