Xhprof PHP性能测试工具
在考虑是否进行性能分析时,你首先要想:应用是否存在性能问题?如果有,你要进一步考虑:这个问题有多大?
如果你不这样做,将会陷入一个陷阱——过早优化,这可能会浪费你的时间。
<?php xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY); $fruits = array( "apple" => "yummy", "orange" => "ah ya, nice", "grape" => "wow, I love it!", "plum" => "nah, not me" ); $obj = new ArrayObject( $fruits ); $it = $obj->getIterator(); // The good thing here is that it can be iterated with foreach loop foreach ($it as $key=>$val) echo $key.":".$val."\n"; $xhprof_data = xhprof_disable(); $XHPROF_ROOT = ""; 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(); $run_id = $xhprof_runs->save_run($xhprof_data, "xhprof_testing"); echo "http://localhost/xhprof_html/index.php?run={$run_id}&source=xhprof_testing\n";
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论