smoren / profiler
Helper for profiling
v0.2.4
2022-12-20 12:45 UTC
Requires
- php: >=7.2.0
- smoren/extended-exceptions: ^1.0
Requires (Dev)
- codeception/codeception: ^4.2.1
- codeception/module-asserts: ^2.0
- php-coveralls/php-coveralls: ^2.0
- phpstan/phpstan: ^1.8
- squizlabs/php_codesniffer: 3.*
README
Profiler helper
How to install to your project
composer require smoren/profiler
Unit testing
composer install
composer test-init
composer test
Usage
use Smoren\Profiler\Profiler; function someTask() { Profiler::start('first'); usleep(10000); Profiler::stop('first'); Profiler::start('second'); usleep(20000); Profiler::stop('second'); } for($i=0; $i<10; ++$i) { someTask(); } Profiler::profile('third', function() { usleep(30000); }); print_r(Profiler::getStatTime()); /* Array ( [second] => 0.2015209197998 [third] => 0.20024418830872 [first] => 0.10135746002197 ) */ print_r(Profiler::getStatCalls()); /* Array ( [first] => 10 [second] => 10 [third] => 1 ) */