Mercurial > hg > isophonics-drupal-site
annotate vendor/phpunit/php-timer/README.md @ 19:fa3358dc1485 tip
Add ndrum files
author | Chris Cannam |
---|---|
date | Wed, 28 Aug 2019 13:14:47 +0100 |
parents | 4c8ae668cc8c |
children |
rev | line source |
---|---|
Chris@0 | 1 [](https://travis-ci.org/sebastianbergmann/php-timer) |
Chris@0 | 2 |
Chris@0 | 3 # PHP_Timer |
Chris@0 | 4 |
Chris@0 | 5 Utility class for timing things, factored out of PHPUnit into a stand-alone component. |
Chris@0 | 6 |
Chris@0 | 7 ## Installation |
Chris@0 | 8 |
Chris@0 | 9 You can add this library as a local, per-project dependency to your project using [Composer](https://getcomposer.org/): |
Chris@0 | 10 |
Chris@0 | 11 composer require phpunit/php-timer |
Chris@0 | 12 |
Chris@0 | 13 If you only need this library during development, for instance to run your project's test suite, then you should add it as a development-time dependency: |
Chris@0 | 14 |
Chris@0 | 15 composer require --dev phpunit/php-timer |
Chris@0 | 16 |
Chris@0 | 17 ## Usage |
Chris@0 | 18 |
Chris@0 | 19 ### Basic Timing |
Chris@0 | 20 |
Chris@0 | 21 ```php |
Chris@0 | 22 PHP_Timer::start(); |
Chris@0 | 23 |
Chris@0 | 24 // ... |
Chris@0 | 25 |
Chris@0 | 26 $time = PHP_Timer::stop(); |
Chris@0 | 27 var_dump($time); |
Chris@0 | 28 |
Chris@0 | 29 print PHP_Timer::secondsToTimeString($time); |
Chris@0 | 30 ``` |
Chris@0 | 31 |
Chris@0 | 32 The code above yields the output below: |
Chris@0 | 33 |
Chris@0 | 34 double(1.0967254638672E-5) |
Chris@0 | 35 0 ms |
Chris@0 | 36 |
Chris@0 | 37 ### Resource Consumption Since PHP Startup |
Chris@0 | 38 |
Chris@0 | 39 ```php |
Chris@0 | 40 print PHP_Timer::resourceUsage(); |
Chris@0 | 41 ``` |
Chris@0 | 42 |
Chris@0 | 43 The code above yields the output below: |
Chris@0 | 44 |
Chris@0 | 45 Time: 0 ms, Memory: 0.50MB |