michelrtm / execution-time-recorder
Class for recording execution times for specific code block or whenever required.
This package's canonical repository appears to be gone and the package has been frozen as a result.
1.0.0
2016-12-07 15:21 UTC
Requires
- php: >=5.5
Requires (Dev)
- phpunit/phpunit: ~5.7
This package is not auto-updated.
Last update: 2019-05-12 11:29:44 UTC
README
Installation & Compatibility
- Installation
-
Use Composer to install all required PHP dependencies:
```bash $ composer require --dev michelrtm/execution-time-recorder ```
-
- Compatibility
- PHP 5.5 or greater is required.
How to use
- Simple usage
$recorder = new MRT\Execution\Time\Recorder(); $timer = $recorder->registerTimer(); $timer->start(); //Execute code here... $timer->stop(); print_r($timer->getElapsedTime()); print_r($recorder->getTotalElapsedTime());
- Calculating the execution time for a code block
$recorder = new MRT\Execution\Time\Recorder(); $callable = function () { $a = 0; for ($i = 0; $i < 1000; $i++) { $a += $i; } return $a; }; print_r($recorder->getCodeBlockExecutionTime($callable));