From b3607055ea440481f98feb886eeaf6761aec666f Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Fri, 21 Jul 2006 15:26:07 +0000 Subject: [PATCH] Profiling --- includes/Database.php | 2 ++ includes/LoadBalancer.php | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/includes/Database.php b/includes/Database.php index 7ffa294587..1812cd1ec3 100644 --- a/includes/Database.php +++ b/includes/Database.php @@ -449,6 +449,7 @@ class Database { */ function open( $server, $user, $password, $dbName ) { global $wguname; + wfProfileIn( __METHOD__ ); # Test for missing mysql.so # First try to load it @@ -508,6 +509,7 @@ class Database { } $this->mOpened = $success; + wfProfileOut( __METHOD__ ); return $success; } /**@}}*/ diff --git a/includes/LoadBalancer.php b/includes/LoadBalancer.php index 314169153b..e9f712e6e1 100644 --- a/includes/LoadBalancer.php +++ b/includes/LoadBalancer.php @@ -627,6 +627,7 @@ class LoadBalancer { function getLagTimes() { global $wgDBname; + wfProfileIn( __METHOD__ ); $expiry = 5; $requestRate = 10; @@ -638,6 +639,7 @@ class LoadBalancer { $chance = max( 0, ( $expiry - $elapsed ) * $requestRate ); if ( mt_rand( 0, $chance ) != 0 ) { unset( $times['timestamp'] ); + wfProfileOut( __METHOD__ ); return $times; } } @@ -659,6 +661,8 @@ class LoadBalancer { # But don't give the timestamp to the caller unset($times['timestamp']); + wfIncrStats( 'lag_cache_miss' ); + wfProfileOut( __METHOD__ ); return $times; } } -- 2.20.1