CakePHP 2.1 Measuring Page Execution Time
-
02-06-2021 - |
Question
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.
Solution
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.
OTHER TIPS
Note that the time returned from microtime is actually in seconds not microseconds according to the docs.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow