timer_stop() wanted to be near timer_start().

git-svn-id: https://develop.svn.wordpress.org/trunk@4174 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2006-09-07 23:26:52 +00:00
parent d51b58448f
commit 58370c3575
2 changed files with 12 additions and 16 deletions

View File

@ -293,22 +293,6 @@ function gzip_compression() {
} }
} }
// functions to count the page generation time (from phpBB2)
// ( or just any time between timer_start() and timer_stop() )
function timer_stop($display = 0, $precision = 3) { //if called like timer_stop(1), will echo $timetotal
global $timestart, $timeend;
$mtime = microtime();
$mtime = explode(' ',$mtime);
$mtime = $mtime[1] + $mtime[0];
$timeend = $mtime;
$timetotal = $timeend-$timestart;
if ( $display )
echo number_format($timetotal,$precision);
return $timetotal;
}
function make_url_footnote($content) { function make_url_footnote($content) {
preg_match_all('/<a(.+?)href=\"(.+?)\"(.*?)>(.+?)<\/a>/', $content, $matches); preg_match_all('/<a(.+?)href=\"(.+?)\"(.*?)>(.+?)<\/a>/', $content, $matches);
$j = 0; $j = 0;

View File

@ -59,6 +59,18 @@ function timer_start() {
$timestart = $mtime; $timestart = $mtime;
return true; return true;
} }
function timer_stop($display = 0, $precision = 3) { //if called like timer_stop(1), will echo $timetotal
global $timestart, $timeend;
$mtime = microtime();
$mtime = explode(' ',$mtime);
$mtime = $mtime[1] + $mtime[0];
$timeend = $mtime;
$timetotal = $timeend-$timestart;
if ( $display )
echo number_format($timetotal,$precision);
return $timetotal;
}
timer_start(); timer_start();
// Change to E_ALL for development/debugging // Change to E_ALL for development/debugging