Replace our mb_substr() fallback implementation with one which is not quite so horrib...
[mediawiki.git] / includes / ProfilerSimpleText.php
blob9252e302289116c5e504d183b458a9f4bee08fdb
1 <?php
2 /**
3 * @file
4 * @ingroup Profiler
5 */
7 require_once( dirname( __FILE__ ) . '/ProfilerSimple.php' );
9 /**
10 * The least sophisticated profiler output class possible, view your source! :)
12 * Put it to StartProfiler.php like this:
14 * require_once( dirname( __FILE__ ) . '/includes/ProfilerSimpleText.php' );
15 * $wgProfiler = new ProfilerSimpleText;
16 * $wgProfiler->visible=true;
18 * @ingroup Profiler
20 class ProfilerSimpleText extends ProfilerSimple {
21 public $visible=false; /* Show as <PRE> or <!-- ? */
23 function getFunctionReport() {
24 if ($this->visible) print "<pre>";
25 else print "<!--\n";
26 uasort($this->mCollated,array('self','sort'));
27 array_walk($this->mCollated,array('self','format'));
28 if ($this->visible) print "</pre>\n";
29 else print "-->\n";
32 /* dense is good */
33 static function sort($a,$b) { return $a['real']<$b['real']; /* sort descending by time elapsed */ }
34 static function format($item,$key) { printf("%3.6f %6d - %s\n",$item['real'],$item['count'], $key); }