Posts Tagged ‘performance’

Test Script Execution Time

Wednesday, May 1st, 2013

// start timing

$mtime = microtime();
$mtime = explode(” “,$mtime);
$mtime = $mtime[1] + $mtime[0];
$starttime = $mtime;

// code to execute

Code to Execute HERE

// revisit timer

$mtime = microtime();
$mtime = explode(” “,$mtime);
$mtime = $mtime[1] + $mtime[0];
$endtime = $mtime;
$totaltime = number_format(($endtime – $starttime),5);

echo “<br /><span style=’display:none;’>Script executed in ” . $totaltime . ” microseconds</span>”;
echo “<br /><span style=’display:none;’>Using ” . memory_get_peak_usage(1) . ” bytes of ram</span>”;