Optionally use a different profile name for master queries
authorTim Starling <tstarling@users.mediawiki.org>
Tue, 28 Mar 2006 05:11:40 +0000 (05:11 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Tue, 28 Mar 2006 05:11:40 +0000 (05:11 +0000)
includes/Database.php

index 59817b2..138792d 100644 (file)
@@ -367,10 +367,16 @@ class Database {
 
                        # Who's been wasting my precious column space? -- TS
                        #$profName = 'query: ' . $fname . ' ' . substr( Database::generalizeSQL( $sql ), 0, 255 );
-                       $profName = 'query: ' . substr( Database::generalizeSQL( $sql ), 0, 255 );
 
-                       wfProfileIn( 'Database::query' );
-                       wfProfileIn( $profName );
+                       if ( is_null( $this->getLBInfo( 'master' ) ) ) {
+                               $queryProf = 'query: ' . substr( Database::generalizeSQL( $sql ), 0, 255 );
+                               $totalProf = 'Database::query';
+                       } else {
+                               $queryProf = 'query-m: ' . substr( Database::generalizeSQL( $sql ), 0, 255 );
+                               $totalProf = 'Database::query-master';
+                       }
+                       wfProfileIn( $totalProf );
+                       wfProfileIn( $queryProf );
                }
 
                $this->mLastQuery = $sql;
@@ -414,8 +420,8 @@ class Database {
                }
 
                if ( $wgProfiling ) {
-                       wfProfileOut( $profName );
-                       wfProfileOut( 'Database::query' );
+                       wfProfileOut( $queryProf );
+                       wfProfileOut( $totalProf );
                }
                return $ret;
        }