# 安装

https://github.com/tideways/php-xhprof-extension
phpize
./configure
make
sudo make install
extension=tideways_xhprof.so
1
2
3
4
5
6

# 调试

tideways_xhprof_enable();

// 放在xhprof下
file_put_contents(
   '/Users/ligan/Documents/PHPProject/Self/xhprof' . DIRECTORY_SEPARATOR . uniqid() . '.saas-canteen.xhprof',
   serialize(tideways_xhprof_disable())
);
1
2
3
4
5
6
7

# 利用xhprof查看

git clone https://github.com/longxinH/xhprof.git ./xhprof
cd xhprof/extension/
/path/to/php7/bin/phpize
./configure --with-php-config=/path/to/php7/bin/php-config
make && sudo make install
1
2
3
4
5
[xhprof]
extension = xhprof.so
xhprof.output_dir = /tmp/xhprof
1
2
3

http://cdn.zjwoo.com/code-galaxy/tideways_xhprof_1.jpeg

http://cdn.zjwoo.com/code-galaxy/tideways_xhprof_2.jpeg

http://cdn.zjwoo.com/code-galaxy/tideways_xhprof_3.jpeg