tomzx/profiler

PHP性能分析器。

v0.1.0 2016-10-26 09:44 UTC

This package is auto-updated.

Last update: 2024-09-10 09:04:09 UTC


README

License Latest Stable Version Latest Unstable Version Build Status Code Quality Code Coverage Total Downloads

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));

许可证

代码遵循MIT许可证。请参阅LICENSE