CakePHP 2.1 Measuring Page Execution Time

China☆狼群 提交于 2019-12-24 00:54:29

问题


How can I Measure the Page Execution Time in CakePHP 2.1? In 1.3 it was rendered in the code when in debug mode.


回答1:


You could use DebugKit Plugin to find out execution time.

Or you can edit index.php in app/ and add:

// top of file
$starTime = microtime(true);
// bottom of file
echo '<!-- Exec time: ', microtime(true) - $startTime, ' -->';

That time will be in microseconds so you could convert it to ms if you want, but DebugKit gives you a lot more information.




回答2:


Note that the time returned from microtime is actually in seconds not microseconds according to the docs.



来源:https://stackoverflow.com/questions/10243141/cakephp-2-1-measuring-page-execution-time

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!