From: Tim Starling Date: Fri, 28 May 2004 05:45:13 +0000 (+0000) Subject: Support for database profiling, profiling bracket in ParserCache.php X-Git-Tag: 1.5.0alpha1~3182 X-Git-Url: http://git.cyclocoop.org/%24self?a=commitdiff_plain;h=727d419e7ebddc0f30db974fe4641ef21dce2aa4;p=lhc%2Fweb%2Fwiklou.git Support for database profiling, profiling bracket in ParserCache.php --- diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 8989b6078d..719b61515d 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -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 ); + } } } diff --git a/includes/ParserCache.php b/includes/ParserCache.php index c682b9039e..74d45f3bb2 100644 --- a/includes/ParserCache.php +++ b/includes/ParserCache.php @@ -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; }