note 76021 deleted from function.microtime by tularis
| From: | tularis@php.net | Date: | Sun, 22 Jun 2008 12:05:35 +0000 |
| Subject: | note 76021 deleted from function.microtime by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-140667@lists.php.net to get a copy of this message | ||
Note Submitter: nrixham at gmail dot com
----
here's an ultra simple script for you all (PHP5 only.. for obvious reasons)
stick this at the top of any script or app, and you'll get a the execution time in microseconds
of the script.
It will output in raw text at the foot of the output, after execution has finished.. so only really
useful for developing (swap the print_r for a logging function for live use?)
<?
class pageExecutionTimer {
private $executionTime;
public function __construct() {
$this->executionTime = microtime(true);
}
public function __destruct() {
print_r(chr(10).chr(13).(microtime(true)-$this->executionTime));
}
}
$pageExecutionTimer = new pageExecutionTimer();
?>