Merge "Use our fork of less.php" into REL1_31
[lhc/web/wiklou.git] / StartProfiler.sample
index d9b5288..bdf2139 100644 (file)
@@ -1,26 +1,38 @@
 <?php
 
 /**
- * To use a profiler, copy this file to StartProfiler.php,
- * and add either:
+ * To use a profiler, copy this file to StartProfiler.php and add:
+ *  $wgProfiler['class'] = 'ProfilerXhprof';
  *
- *   // Does not support the debugging toolbar
- *   // Stores profiling information in the database
- *   // Requires running maintenance/archives/patch-profiling.sql
- *   $wgProfiler['class'] = 'ProfilerSimpleDB'
+ * For output, set the 'output' key to an array of class names, one for each
+ * output type you want the profiler to generate. For example:
+ *  $wgProfiler['output'] = array( 'ProfilerOutputText' );
  *
- * or:
+ * The output classes available to you by default are ProfilerOutputDb,
+ * ProfilerOutputDump, ProfilerOutputStats, ProfilerOutputText, and
+ * ProfilerOutputUdp.
  *
- *   // Supports the debugging toolbar
- *   // Does not store profiling information in the database
- *   $wgProfiler['class'] = 'ProfilerStandard';
+ * ProfilerOutputStats outputs profiling data as StatsD metrics. It expects
+ * that you have set the $wgStatsdServer configuration variable to the host (or
+ * host:port) of your statsd server.
  *
- * Or for a sampling profiler:
- *   if ( !mt_rand( 0, 100 ) ) {
- *       $wgProfiler['class'] = 'ProfilerSimpleDB';
- *   } else {
- *       $wgProfiler['class'] = 'ProfilerStub';
- *   }
+ * ProfilerOutputText will output profiling data in the page body as a comment.
+ * You can make the profiling data in HTML render as part of the page content
+ * by setting the 'visible' configuration flag:
+ *  $wgProfiler['visible'] = true;
  *
- * Configuration of the profiler output can be done in LocalSettings.php
+ * 'ProfilerOutputDb' expects a database table that can be created by applying
+ * maintenance/archives/patch-profiling.sql to your database.
+ *
+ * 'ProfilerOutputDump' expects a $wgProfiler['outputDir'] telling it where to
+ * write dump files. The files produced are compatible with the XHProf gui.
+ * For a rudimentary sampling profiler:
+ *   $wgProfiler['class'] = 'ProfilerXhprof';
+ *   $wgProfiler['output'] = array( 'ProfilerOutputDb' );
+ *   $wgProfiler['sampling'] = 50; // one every 50 requests
+ * This will use ProfilerStub for non-sampled cases.
+ *
+ * For performance, the profiler is always disabled for CLI scripts as they
+ * could be long running and the data would accumulate. Use the '--profiler'
+ * parameter of maintenance scripts to override this.
  */