From 2594740f9d439a3703057ec48fe606e145f5297d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20FIDRY?= <5175937+theofidry@users.noreply.github.com> Date: Thu, 8 Dec 2022 00:26:12 +0100 Subject: [PATCH] Add documentation about the diagnosis commands (#65) --- .gitattributes | 1 - README.md | 28 ++++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/.gitattributes b/.gitattributes index c331395..d24aad7 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,6 +1,5 @@ /.github/ export-ignore /.phive/ export-ignore -/bin/ export-ignore /e2e/ export-ignore /stubs/ export-ignore /tests/ export-ignore diff --git a/README.md b/README.md index 4082beb..2c658b5 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,8 @@ composer require fidry/cpu-core-counter ```php use Fidry\CpuCoreCounter\CpuCoreCounter; +use Fidry\CpuCoreCounter\NumberOfCpuCoreNotFound; +use Fidry\CpuCoreCounter\Finder\DummyCpuCoreFinder; $counter = new CpuCoreCounter(); @@ -20,6 +22,15 @@ try { return 1; // Fallback value } +// An alternative form where we not want to catch the exception: + +$counter = new CpuCoreCounter([ + ...CpuCoreCounter::getDefaultFinders(), + new DummyCpuCoreFinder(1), // Fallback value +]); + +$counter->getCount(); // e.g. 8 + ``` @@ -53,6 +64,23 @@ $cores = (new CpuCoreCounter($finders))->getCount(); ``` +### Checks what finders find what on your system + +You have two commands available that provides insight about what the finders +can find: + +``` +$ make diagnosis # From this repository +$ ./vendor/fidry/cpu-core-counter/bin/diagnose.php # From the library +``` + +And: +``` +$ make execute # From this repository +$ ./vendor/fidry/cpu-core-counter/bin/execute.php # From the library +``` + + ## License This package is licensed using the MIT License.