Created
June 5, 2012 11:37
-
-
Save neerav/2874507 to your computer and use it in GitHub Desktop.
Measure execution time of code block
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- put this at the top of the page --> | |
<?php | |
$mtime = microtime(); | |
$mtime = explode(" ",$mtime); | |
$mtime = $mtime[1] + $mtime[0]; | |
$starttime = $mtime; | |
?> | |
<!-- ******************************* --> | |
<!-- put other code and html in here --> | |
<!-- ******************************* --> | |
<!-- put this code at the bottom of the page --> | |
<?php | |
$mtime = microtime(); | |
$mtime = explode(" ",$mtime); | |
$mtime = $mtime[1] + $mtime[0]; | |
$endtime = $mtime; | |
$totaltime = ($endtime - $starttime); | |
echo "Last code block was executed in ".$totaltime." seconds"; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment