Added feature for limiting profiling to every n requests
authorMr. E23 <e23@users.mediawiki.org>
Tue, 18 Nov 2003 23:49:11 +0000 (23:49 +0000)
committerMr. E23 <e23@users.mediawiki.org>
Tue, 18 Nov 2003 23:49:11 +0000 (23:49 +0000)
includes/DefaultSettings.php
includes/Setup.php

index f662db5..99a60f9 100644 (file)
@@ -130,10 +130,10 @@ $wgUseTeX = false;
 $wgProfiling = false; # Enable for more detailed by-function times in debug log
 $wgProfileLimit = 0.0; # Only record profiling info for pages that took longer than this
 $wgProfileOnly = false; # Don't put non-profiling info into log file
+$wgProfileSampleRate = 1; # Only profile every n requests when profiling is turned on
 $wgDebugProfiling = false; # Detects non-matching wfProfileIn/wfProfileOut calls
 $wgDebugFunctionEntry = 0; # Output debug message on every wfProfileIn/wfProfileOut
 
-
 $wgDisableCounters = false;
 $wgDisableTextSearch = false;
 $wgDisableSearchUpdate = false; # If you've disabled search semi-permanently, this also disables updates to the table. If you ever re-enable, be sure to rebuild the search table.
index c4c1de0..944c758 100644 (file)
@@ -8,7 +8,7 @@
 if( !isset( $wgProfiling ) )
        $wgProfiling = false;
 
-if ( $wgProfiling ) {
+if ( $wgProfiling and (0 == rand() % $wgProfileSampleRate ) ) {        
        include_once( "Profiling.php" );
 } else {
        function wfProfileIn( $fn ) {}