Re: benchmarking php
| From: | Wolfram Kriesing | Date: | Wed, 23 Jan 2002 13:31:29 +0000 |
| Subject: | Re: benchmarking php | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-4112@lists.php.net to get a copy of this message | ||
> > I think most PHP programmers don't know how to :-)
> > Could someone please expand on how it can be done?
>
> Well you can either:
> 1) start and stop a timer in various parts of your script and then
> output the results
isn't there a class which serves some kind of timer stuff
i.e. to be able to do something like this
// give the timer a name to be able to use multiple timers
$timer->start('someName');
.... some code that needs performance measuring
print 'action took: '.$timer->getDiff('someName');
"getDiff" is just a name i made up for the method that measures the
time difference to the call to "start"
i was not searching if there is something like this in PEAR
what i am doing still is the following (i.e. in the tree class)
if( $this->debug )
{
$startTime = split(" ",microtime());
$startTime = $startTime[1]+$startTime[0];
}
.... some code that needs performance measuring
if( $this->debug )
{
$endTime = split(" ",microtime());
$endTime = $endTime[1]+$endTime[0];
print( " building took: ".($endTime - $startTime)." <br>"
);
}
but its not really that cool i think
--
Wolfram