Fix fail from r69755, press save, actually do "LIMIT_SML2, LIMIT_BIG2 are in ApiBase...
[lhc/web/wiklou.git] / includes / ProfilerSimpleText.php
1 <?php
2 /**
3 * @file
4 * @ingroup Profiler
5 */
6
7 require_once( dirname( __FILE__ ) . '/ProfilerSimple.php' );
8
9 /**
10 * The least sophisticated profiler output class possible, view your source! :)
11 *
12 * Put the following 3 lines in StartProfiler.php:
13 *
14 * require_once( dirname( __FILE__ ) . '/includes/ProfilerSimpleText.php' );
15 * $wgProfiler = new ProfilerSimpleText;
16 * $wgProfiler->visible=true;
17 *
18 * @ingroup Profiler
19 */
20 class ProfilerSimpleText extends ProfilerSimple {
21 public $visible=false; /* Show as <PRE> or <!-- ? */
22 static private $out;
23
24 function getFunctionReport() {
25 global $wgRequest, $wgOut;
26
27 if($this->mTemplated) {
28 uasort($this->mCollated,array('self','sort'));
29 array_walk($this->mCollated,array('self','format'));
30 if ($this->visible) {
31 print '<pre>'.self::$out.'</pre>';
32 } else {
33 print "<!--\n".self::$out."\n-->\n";
34 }
35 }
36 }
37
38 /* dense is good */
39 static function sort($a,$b) { return $a['real']<$b['real']; /* sort descending by time elapsed */ }
40 static function format($item,$key) { self::$out .= sprintf("%3.6f %6d - %s\n",$item['real'],$item['count'], $key); }
41 }