首页 > 其他 > 详细

xhprof

时间:2015-05-16 20:06:35      阅读:162      评论:0      收藏:0      [点我收藏+]
#官网下载
http://pecl.php.net/package/xhprof
tar zxf xhprof-0.9.2.tgz
 
cd xhprof-0.9.2/extension/
 
sudo phpize
./configure --with-php-config=/usr/local/php/bin/php-config
sudo make
sudo make install
 
#php.ini
[xhprof]
extension=xhprof.so;
; directory used by default implementation of the iXHProfRuns
; interface (namely, the XHProfRuns_Default class) for storing
; XHProf runs.
;
;xhprof.output_dir=<directory_for_storing_xhprof_runs>
xhprof.output_dir=/tmp/xhprof

php中的代码:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY);
/** monitor begin */
include ‘common.php‘;
$host ‘127.0.0.1‘;
$port = 11216;
$objMc new Memcache();
$objMc->addServer( $host,$port,true,1,1,15,true );
$key ‘test‘;
$value file_get_contents‘b.js‘ );
$str = md5( $value );
dump( $str );
$objMc->set( $key,$value ); 
md5(base64_encode(pack(‘N6‘, mt_rand(), mt_rand(), mt_rand(), mt_rand(), mt_rand(), uniqid())));
$rs $objMc->get( $key );
dump( md5( $rs ) );
dump($rs) ;
$data = xhprof_disable();
include_once "xhprof_lib/utils/xhprof_lib.php"
include_once "xhprof_lib/utils/xhprof_runs.php"
$objXhprofRun new XHProfRuns_Default();
$run_id $objXhprofRun->save_run($data‘memcache‘);
/** monitor end */
dump( $run_id );
exit;

xhprof

原文:http://www.cnblogs.com/allenhaozi/p/4508407.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!