简体   繁体   English

更好的个人资料?

[英]Better way to profile?

Is there a better way to profile code then: 有没有更好的方法来分析代码呢:

$start1 = microtime(TRUE);
for($i=0;$i<count($array);$i++)
 {
    //do something
 }
$time1 = microtime(TRUE) - $start1;

Xdebug or Zend Debugger if you have some difficulty to install Xdebug. 如果您在安装Xdebug时遇到一些困难,请使用Xdebug或Zend Debugger。

Their profiler will time everything for you without any modification of your code. 他们的探查器将为您计时所有内容,而无需修改您的代码。

http://www.xdebug.org/ http://www.xdebug.org/

http://www.zend.com/en/community/pdt http://www.zend.com/en/community/pdt

http://devzone.zend.com/article/2899-Profiling-PHP-Applications-With-xdebug - a serie of tutorials about xdebug. http://devzone.zend.com/article/2899-Profiling-PHP-Applications-With-xdebug-有关xdebug的一系列教程。

Without using an external tool, I would say you've done the best you can. 如果不使用外部工具,我会说您已尽力而为。

If you want to use a tool built for the purpose, the other answers are dead-on. 如果您要使用为此目的而构建的工具,则其他答案仍然是固定的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM