1 下载
http://pan.baidu.com/s/1o8kwNyy
2 将xhprof.dll放入php的扩展ext目录
修改php.ini文件 添加xhprof扩展
[xhprof] extension=php_xhprof.dll xhprof.output_dir="E:/workspace/xhprof/logs"
3 代码中应用
入口文件放入
xhprof_enable(XHPROF_FLAGS_MEMORY | XHPROF_FLAGS_CPU);
/** * return */ if (!function_exists('xpTest')) { function xpTest() { $xhprof_data = xhprof_disable(); $XHPROF_ROOT = "E:/workspace/xhprof"; include_once $XHPROF_ROOT . "/xhprof_lib/utils/xhprof_lib.php"; include_once $XHPROF_ROOT . "/xhprof_lib/utils/xhprof_runs.php"; $xhprof_runs = new XHProfRuns_Default(); $server_name = $_SERVER['SERVER_NAME']; $request_uri = $_SERVER['REQUEST_URI']; $request_uri = str_replace("/", "_", $request_uri); $time = Date("Ymd_H_i_s"); $ext_name = $time; $run_id = $xhprof_runs->save_run($xhprof_data, $ext_name); echo "分析"; exit; } }
参考:
http://windows.php.net/downloads/pecl/releases/xhprof/0.10.6/
http://dev.freshsite.pl/php-extensions/xhprof.html
http://www.du52.com/text.php?id=559
http://www.cnblogs.com/siqi/p/3790186.html
http://www.xhprof.com/
http://blog.aboutc.net/profiling/17/php-profiler-xhprof