From 727d419e7ebddc0f30db974fe4641ef21dce2aa4 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Fri, 28 May 2004 05:45:13 +0000 Subject: [PATCH] Support for database profiling, profiling bracket in ParserCache.php --- includes/GlobalFunctions.php | 6 ++++-- includes/ParserCache.php | 5 +++++ 2 files changed, 9 insertions(+), 2 deletions(-) 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; } -- 2.20.1