note 63575 added to function.microtime
| From: | james_hicks at _despam_iinet dot net dot au | Date: | Fri, 24 Mar 2006 04:42:31 +0000 |
| Subject: | note 63575 added to function.microtime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-106513@lists.php.net to get a copy of this message | ||
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);
----
Server IP: 203.16.234.91
Probable Submitter: 210.50.6.166
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.microtime.php
Edit -- http://master.php.net/note/edit/63575
Del: integrated -- http://master.php.net/note/delete/63575/integrated
Del: useless -- http://master.php.net/note/delete/63575/useless
Del: bad code -- http://master.php.net/note/delete/63575/bad+code
Del: spam -- http://master.php.net/note/delete/63575/spam
Del: non-english -- http://master.php.net/note/delete/63575/non-english
Del: in docs -- http://master.php.net/note/delete/63575/in+docs
Del: other reasons-- http://master.php.net/note/delete/63575
Reject -- http://master.php.net/note/reject/63575
Search -- http://master.php.net/manage/user-notes.php