Re: Timing PHP code
| From: | Chris Lee | Date: | Tue, 28 Nov 2000 03:13:26 +0000 |
| Subject: | Re: Timing PHP code | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-27648@lists.php.net to get a copy of this message | ||
It would be easy to write one.
<?
class timer
{
var $s_time;
function timer()
{
$this->s_time = $this->mtime();
}
function mtime()
{
$mtime = microtime();
$mtime = ereg_replace('\.', '', $mtime);
$mtime = explode(' ', $mtime);
$mtime = $mtime[1] . $mtime[0];
return($mtime);
}
function break_point()
{
echo ($this->mtime() - $this->s_time) . "<br>\n";
$this->s_time = $this->mtime();
}
}
$timer = new timer();
$timer->break_point();
$timer->break_point();
$timer->break_point();
?>
Chris Lee
Mediawaveonline.com
In article <Pine.LNX.4.30.0011281148520.27743-100000@boix.drac.ct>,
ddiaz@drac.com wrote:
>
> Hi,
>
> I'd like to know if there's *already* any program to time a php code
> line by line since I want to track all the bottlenecks in a big php page
> (thousands lines of code), and I wouldn't have to do it by setting
> "breakpoints" to all the functions from scratch.
>
>
> Any ideas or suggestions will be welcomed.
>
>
> --- Sistemes - DRAC telemàtic ---------------------
> c/ Transversal 226 - 08225 Terrassa Tel: +34 93 736 48 30
> mailto:david@drac.com
> ----------------------------------------------------
>
>