kanel / benchmark
There is no license information available for the latest version (1.0.0) of this package.
Benchmark your code by tracking duration and memory usage of your code
1.0.0
2017-04-02 20:37 UTC
Requires
- kanel/memoryusage: ~1.0.0
- kanel/timer: ~1.0.0
Requires (Dev)
- phpunit/phpunit: 6.0.8
This package is not auto-updated.
Last update: 2024-11-10 03:33:39 UTC
README
A simple tool to benchmark time execution and memory usage
#How it works :
-
Start the benchmarkg
Benchmark::start();
-
Mark a place as a lap (the benchmark will continue)
$usage = Benchmark::lap();
where $usage is an array :
[ 'time' => ..., 'memory' => ..., ]
-
If you want the benchmark between the two last laps, send the following parameter:
$usage = Benchmark::lap(Benchmark::FROM_LAST_LAP);
-
To stop the Benchmark and get the time/memory from the beginning (the start)
$usage = Benchmark::stop();
-
To stop the Benchmark tracking and get the memory used and duration from the last lap
$usage = Benchmark::stop(Benchmark::FROM_LAST_LAP);
-
To get the Benchmark history
$usage = Benchmark::getHistory();