Skip to content

Commit

Permalink
Add documentation about the diagnosis commands (#65)
Browse files Browse the repository at this point in the history
  • Loading branch information
theofidry authored Dec 7, 2022
1 parent 4f1d36e commit 2594740
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/.github/ export-ignore
/.phive/ export-ignore
/bin/ export-ignore
/e2e/ export-ignore
/stubs/ export-ignore
/tests/ export-ignore
Expand Down
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -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

```


Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 2594740

Please sign in to comment.