note 63575 deleted from function.microtime by bjori
| From: | bjori@php.net | Date: | Fri, 24 Mar 2006 08:59:18 +0000 |
| Subject: | note 63575 deleted from function.microtime by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-106521@lists.php.net to get a copy of this message | ||
Note Submitter: james_hicks at _despam_iinet dot net dot au
----
Here's what I use to performance profile a PHP script:
function profile($s) {
global $lasttime;
global $times;
$t=round(microtime(true)-$lasttime,3);
$times[$s]=$times[$s]+$t;
$lasttime=microtime(true);
}
Initialize (run right at the start of your script):
$starttime=$lasttime=microtime(true);
global $starttime;
global $lasttime;
Output:
$times['Counted']=array_sum($times);
$times['Total']=round(microtime(true)-$starttime,3);
var_dump($times);