make it static :)
[lhc/web/wiklou.git] / includes / ProfilerSimpleText.php
1 <?php
2 /* The least sophisticated profiler output class possible, view your source! :)
3
4 Put it to StartProfiler.php like this:
5
6 require_once( dirname(__FILE__).'/includes/ProfilerSimpleText.php' );
7 $wgProfiler = new ProfilerSimpleText;
8 $wgProfiler->visible=true;
9
10 */
11 require_once(dirname(__FILE__).'/ProfilerSimple.php');
12 class ProfilerSimpleText extends ProfilerSimple {
13 public $visible=false; /* Show as <PRE> or <!-- ? */
14 function getFunctionReport() {
15 if ($this->visible) print "<pre>";
16 else print "<!--\n";
17 uasort($this->mCollated,array('self','sort'));
18 array_walk($this->mCollated,array('self','format'));
19 if ($this->visible) print "</pre>\n";
20 else print "-->\n";
21 }
22 /* dense is good */
23 static function sort($a,$b) { return $a['real']<$b['real']; /* sort descending by time elapsed */ }
24 static function format($item,$key) { printf("%3.6f %6d - %s\n",$item['real'],$item['count'], $key); }
25 }
26 ?>