Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Do not check the system load by default #144

Merged
merged 1 commit into from
Aug 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions src/CpuCoreCounter.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,23 @@ public function __construct(?array $finders = null)
* previous example, it will return 5 cores. How busy is
* the system is determined by the system load average
* (see $systemLoadAverage).
* @param float|null $systemLoadAverage The system load average. If not provided, it will be
* retrieved using `sys_getloadavg()` to check the load
* of the system in the past minute. Should be a positive
* float.
* @param float|null $systemLoadAverage The system load average. If passed, it will use
* this information to limit the available cores based
* on the _available_ resources. For instance, if there
* is 10 cores but 3 are busy, then only 7 cores will
* be considered for further calculation. If set to
* `null`, it will use `sys_getloadavg()` to check the
* load of the system in the past minute. You can
* otherwise pass an arbitrary value. Should be a
* positive float.
*
* @see https://php.net/manual/en/function.sys-getloadavg.php
*/
public function getAvailableForParallelisation(
int $reservedCpus = 0,
?int $countLimit = null,
?float $loadLimit = null,
?float $systemLoadAverage = null
?float $systemLoadAverage = 0.
): ParallelisationResult {
self::checkCountLimit($countLimit);
self::checkLoadLimit($loadLimit);
Expand Down