note 99307 modified in function.microtime by danbrown
| From: | danbrown@php.net | Date: | Tue, 10 Aug 2010 13:40:52 +0000 |
| Subject: | note 99307 modified in function.microtime by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-171513@lists.php.net to get a copy of this message | ||
I wrote a class which allows to time execution of php scripts very easily. You can even time
multiple separate blocks and then get the total time at the end.
The class is pretty long so I won't post it here, but here's the link:
http://codeaid.net/php/calculate-script-execution-time-(php-class)
An quick usage example:
<?php
for ($i = 0; $i < 100; $i++) {
// calculate the time it takes to run fx()
Timer::start();
fx();
Timer::stop();
fy();
// calculate the time it takes to run fz()
Timer::start();
fz();
Timer::stop();
}
print Timer::get();
?>
--was--
I wrote a class which allows to time execution of php scripts very easily. You can even time
multiple separate blocks and then get the total time at the end.
The class is pretty long so I won't post it here, but here's the link:
http://codeaid.net/php/calculate-script-execution-time-(php-class)
An quick usage example:
<?php
for ($i = 0; $i < 100; $i++) {
// calculate the time it takes to run fx()
Timer::start();
fx();
Timer::stop();
fy();
// calculate the time it takes to run fz()
Timer::start();
fz();
Timer::stop();
}
print Timer::get();
http://php.net/manual/en/function.microtime.php