tomzx / profiler
PHP性能分析器。
v0.1.0
2016-10-26 09:44 UTC
Requires
- php: >=7.0
Requires (Dev)
- phpunit/phpunit: ^5
This package is auto-updated.
Last update: 2024-09-10 09:04:09 UTC
README
PHP Profiler
是一个提供性能分析功能的轻量级库。它使用Chrome DevTools的一部分Chrome调试协议。这意味着您可以生成兼容.cpuprofile
的文件,然后可以在开发工具中的Chrome配置文件中加载这些文件。
入门
- 在控制台,
php composer.phar require tomzx/profiler
$profiler = new \tomzx\Profiler\StackBasedProfiler(); $profiler->start(); // In your code $profiler->push('My identifier'); ///... $profiler->pop(); $profile = $profiler->stop(); file_put_contents('test.cpuprofile', json_encode($profile));