CakePHP 2.1 Measuring Page Execution Time

2019-07-02 01:28发布

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.

2条回答
时光不老,我们不散
2楼-- · 2019-07-02 01:58

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

查看更多
Anthone
3楼-- · 2019-07-02 02:16

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.

查看更多
登录 后发表回答