axios / xhprof-composer
xhprof 的 composer 库
1.0.1
2018-11-30 08:28 UTC
Requires
- php: >=7.0
- axios/api-tool: ^1.1
Requires (Dev)
- composer/composer: 1.0.*@dev
This package is auto-updated.
Last update: 2024-09-21 21:01:59 UTC
README
xhprof-composer
xhprof 的 composer 库
需要安装 xhprof PHP 扩展
git clone https://github.com/longxinH/xhprof.git
cd xhprof/extension/
/usr/local/php7/bin/phpize
./configure --with-php-config=/usr/local/php7/bin/php-config
make
make install
vim /usr/local/php7/lib/php.ini
extension=xhprof.so;
service php-fpm restart
安装
composer require axios/xhprof-composer
使用
- 创建 xhprof_runs 的记录
namespace xhprof; require_once __DIR__.'/../vendor/autoload.php'; XHProf::start(); /*** begin ***/ dump('this is example for use xhprof-composer'); $a = pow(2, 10); dump($a); /*** end ***/ $report = XHProf::end('test'); dump($report); $run_id = XHProf::getRunId('test'); dump($run_id);
- 查询
dump(XHProfRuns::query()->find($run_id)); $list = [ '38cece5b1ce049e446b5f58fba0aba7c', '86cd5712d2a679efe80c743d1d2342e8', '773a5a2a3a50ebf16fa0dc5256cafd46' ]; $data = XHProfRuns::query()->select($list); dump($data);
- 获取报告
$report = XHProf::report($run_id); dump($report->getTotalCpuTime()); dump($report->getTotalMemory()); dump($report->getList()); dump($report->getTree());