From: Domas Mituzas Date: Fri, 30 Dec 2005 23:14:34 +0000 (+0000) Subject: close profiling on script exits instead of page flushing X-Git-Tag: 1.6.0~835 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=70c5b8cf4296d3593536cbdcacfc75831ab6fedd;p=lhc%2Fweb%2Fwiklou.git close profiling on script exits instead of page flushing --- diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index bae7751977..f4eadbebb5 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -247,7 +247,7 @@ function logProfilingData() { $forward .= ' from ' . $_SERVER['HTTP_FROM']; if( $forward ) $forward = "\t(proxied via {$_SERVER['REMOTE_ADDR']}{$forward})"; - if( $wgUser->isAnon() ) + if( is_object($wgUser) && $wgUser->isAnon() ) $forward .= ' anon'; $log = sprintf( "%s\t%04.3f\t%s\n", gmdate( 'YmdHis' ), $elapsed, @@ -547,6 +547,10 @@ function wfAbruptExit( $error = false ){ } else { wfDebug('WARNING: Abrupt exit\n'); } + + wfProfileClose(); + logProfilingData(); + if ( !$error ) { $wgLoadBalancer->closeAll(); } diff --git a/includes/Skin.php b/includes/Skin.php index fbfd17a92c..58007b8348 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -249,7 +249,6 @@ class Skin extends Linker { $out->out( $this->afterContent() ); - wfProfileClose(); $out->out( $out->reportTime() ); $out->out( "\n" ); diff --git a/index.php b/index.php index fd8bb699f3..3436e572e1 100644 --- a/index.php +++ b/index.php @@ -4,6 +4,7 @@ * @package MediaWiki */ $wgRequestTime = microtime(); +$wgRUstart = getrusage(); unset( $IP ); @ini_set( 'allow_url_fopen', 0 ); # For security... @@ -285,6 +286,7 @@ foreach ( $wgPostCommitUpdateList as $up ) { wfProfileOut( 'main-cleanup' ); +wfProfileClose(); logProfilingData(); $wgLoadBalancer->closeAll(); wfDebug( "Request ended normally\n" );