Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
benvilliere committed Mar 11, 2019
1 parent f1d8cfb commit 17da8a7
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,25 @@ use Angle\Chrono;

The shortest way to benchmark your code is to use the benchmark method:
```php
print Chrono::benchmark(function () {
echo Chrono::benchmark(function () {
sleep(1);
}); // Time: 1 second (1002 ms)
});
```

Output:
```
Time: 1 second (1002 ms)
```

By default, it invokes the 'meter' method which pretty-prints the output. Optionally, you can pass a second parameter to invoke any available formatting methods (ms, seconds, minutes):
```php
print Chrono::benchmark(function () {
echo Chrono::benchmark(function () {
sleep(1);
}, 'ms'); // 1002
}, 'ms');
```
Output:
```
1002
```

Manual usage:
Expand Down

0 comments on commit 17da8a7

Please sign in to comment.