Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/axiosleo/xhprof-composer
composer library for xhprof
https://github.com/axiosleo/xhprof-composer
composer php7 xhprof
Last synced: about 2 months ago
JSON representation
composer library for xhprof
- Host: GitHub
- URL: https://github.com/axiosleo/xhprof-composer
- Owner: AxiosLeo
- License: mit
- Created: 2018-05-02T01:57:48.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-12-21T06:04:37.000Z (about 6 years ago)
- Last Synced: 2024-10-26T13:43:16.483Z (2 months ago)
- Topics: composer, php7, xhprof
- Language: PHP
- Size: 27.3 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Latest Stable Version](https://poser.pugx.org/axios/xhprof-composer/v/stable)](https://packagist.org/packages/axios/xhprof-composer)
[![License](https://poser.pugx.org/axios/xhprof-composer/license)](https://packagist.org/packages/axios/xhprof-composer)# xhprof-composer
> composer library for xhprof## Need install xhprof php extension
```shell
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 installvim /usr/local/php7/lib/php.ini
``````shell
extension=xhprof.so;
``````shell
service php-fpm restart
```## Install
```shell
composer require axios/xhprof-composer
```## Use
* create record of xhprof_runs
```phpnamespace 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);```
* query
```php
dump(XHProfRuns::query()->find($run_id));$list = [
'38cece5b1ce049e446b5f58fba0aba7c',
'86cd5712d2a679efe80c743d1d2342e8',
'773a5a2a3a50ebf16fa0dc5256cafd46'
];$data = XHProfRuns::query()->select($list);
dump($data);```
* get report
```php
$report = XHProf::report($run_id);dump($report->getTotalCpuTime());
dump($report->getTotalMemory());
dump($report->getList());
dump($report->getTree());
```