Profiling
authorTim Starling <tstarling@users.mediawiki.org>
Fri, 21 Jul 2006 15:26:07 +0000 (15:26 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Fri, 21 Jul 2006 15:26:07 +0000 (15:26 +0000)
includes/Database.php
includes/LoadBalancer.php

index 7ffa294..1812cd1 100644 (file)
@@ -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;
        }
        /**@}}*/
index 3141691..e9f712e 100644 (file)
@@ -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;
        }
 }