I use this function:
function echo_pt($add='') {
static $pt = 0;
if($pt==0) {
$pt = miro_time();
return;
}
$time_start = explode(' ', $pt);
$time_end = explode(' ', microtime());
$parse_time = number_format(($time_end[1] + $time_end[0] - ($time_start[1] + $time_start[0])), 3);
echo '<!-- Parse Time '.$add.': ' . $parse_time . 's -->';
$pt=microtime();
}


Usage:
it needs to be initialized first:
echo_pt();
then simply call as many times as you need:
echo_pt('some string');
and it will show you seconds elapsed from the last call to this function, so you can easily see where the script spends most of its time. Instead of echoing it you can append it to a file.


Lasse Laursen wrote:

Hi all,

We are "debugging" some web applications to try to determine where the
problems with long execution time is.

Is it possible to log the execution time of each script executed to a
logfile? The PHP processes are run as FastCGI under Zeus.

Regards
--
Lasse Laursen · VP, Hosting Technology · NetGroup A/S
St. Kongensgade 40H · DK-1264 Copenhagen K, Denmark
Phone: +45 3370 1526 · Fax: +45 3313 0066

- Don't be fooled by cheap finnish imitations - BSD is the One True Code





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to