If you’re completing some potentially lengthy operations within a PHP script you may want to track how long the script is taking to run so you can compare after making optimisations.

Place the following code at the top of your script:

Then place the following code after your code

This will then return in seconds how long the code in between the two pieces of code have taken to run. This is measuring wall-clock time opposed to the actual CPU time but can still give you a really good idea of how efficient your scripts are.

Dave Macaulay
Dave Macaulay
I'm an enthusiastic, slightly eccentric Magento developer who bores with the idea of another basic brief.