Xhprof Application

WBOY
Release: 2016-07-28 08:25:47
Original
1239 people have browsed it

For a long time, I have used a small plug-in written by myself for PHP debugging and running performance monitoring, and I feel that it is okay. But when I was browsing around just now, I found something called Xhprof. After a brief look at the introduction, it seemed to be similar to my little plug-in. I would like to sort out the applications of Xhprof and compare it with my plug-in.

Official website

http://www.xhprof.com/
Copy after login

Install

wget http://pecl.php.net/get/xhprof-0.9.4.tgz tar zxf xhprof-0.9.4.tgz cd xhprof-0.9.4/extension/ phpize ./configure --with-php-config=/usr/local/php/bin/php-config make make install
Copy after login

Configure PHP.ini

# vi /usr/local/php/etc/php.ini
Copy after login
[xhprof] extension=xhprof.so; xhprof.output_dir=/tmp/xhprof
Copy after login

Application 1

 xhprof_enable(); 【PHP业务代码】 $data = xhprof_disable(); // xhprof_lib在下载的包里存在这个目录,记得将目录包含到运行的php代码中include_once"xhprof_lib/utils/xhprof_lib.php"; include_once"xhprof_lib/utils/xhprof_runs.php"; $objXhprofRun = new XHProfRuns_Default(); // 第一个参数j是xhprof_disable()函数返回的运行信息// 第二个参数是自定义的命名空间字符串(任意字符串),// 返回运行ID,用这个ID查看相关的运行结果$run_id = $objXhprofRun->save_run($data, "xhprof"); var_dump($run_id);
Copy after login

Application 2

//cpu:XHPROF_FLAGS_CPU 内存:XHPROF_FLAGS_MEMORY,这两个都是整形常量,可以相加 xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY); 【PHP业务代码】 $data = xhprof_disable(); 
Copy after login
').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });

The above has introduced the Xhprof application, including aspects of it. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!