Support for database profiling, profiling bracket in ParserCache.php
authorTim Starling <tstarling@users.mediawiki.org>
Fri, 28 May 2004 05:45:13 +0000 (05:45 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Fri, 28 May 2004 05:45:13 +0000 (05:45 +0000)
includes/GlobalFunctions.php
includes/ParserCache.php

index 8989b60..719b615 100644 (file)
@@ -235,7 +235,7 @@ function logProfilingData()
        list( $usec, $sec ) = explode( " ", $wgRequestTime );
        $start = (float)$sec + (float)$usec;
        $elapsed = $now - $start;
-       if ( "" != $wgDebugLogFile ) {
+       if ( $wgProfiling ) {
                $prof = wfGetProfilingOutput( $start, $elapsed );
                $forward = "";
                if( !empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) )
@@ -251,7 +251,9 @@ function logProfilingData()
                $log = sprintf( "%s\t%04.3f\t%s\n",
                  gmdate( "YmdHis" ), $elapsed,
                  urldecode( $_SERVER['REQUEST_URI'] . $forward ) );
-               error_log( $log . $prof, 3, $wgDebugLogFile );
+               if ( "" != $wgDebugLogFile ) {
+                       error_log( $log . $prof, 3, $wgDebugLogFile );
+               }
        }
 }
 
index c682b90..74d45f3 100644 (file)
@@ -12,6 +12,9 @@ class ParserCache
 
        function get( &$article, &$user ) {
                global $wgMemc;
+               $fname = "ParserCache::get";
+               wfProfileIn( $fname );
+
                $hash = $user->getPageRenderingHash();
                $pageid = intval( $article->getID() );
                $key = $this->getKey( $article, $user );
@@ -25,6 +28,8 @@ class ParserCache
                } else {
                        $value = false;
                }
+
+               wfProfileOut( $fname );
                return $value;
        }