close profiling on script exits instead of page flushing
authorDomas Mituzas <midom@users.mediawiki.org>
Fri, 30 Dec 2005 23:14:34 +0000 (23:14 +0000)
committerDomas Mituzas <midom@users.mediawiki.org>
Fri, 30 Dec 2005 23:14:34 +0000 (23:14 +0000)
includes/GlobalFunctions.php
includes/Skin.php
index.php

index bae7751..f4eadbe 100644 (file)
@@ -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();
        }
index fbfd17a..58007b8 100644 (file)
@@ -249,7 +249,6 @@ class Skin extends Linker {
 
                $out->out( $this->afterContent() );
 
-               wfProfileClose();
                $out->out( $out->reportTime() );
 
                $out->out( "\n</body></html>" );
index fd8bb69..3436e57 100644 (file)
--- 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" );