From: Aaron Schulz Date: Tue, 5 Jul 2011 06:39:07 +0000 (+0000) Subject: Added percentages to ProfilerSimpleText X-Git-Tag: 1.31.0-rc.0~29067 X-Git-Url: http://git.cyclocoop.org/%24action?a=commitdiff_plain;h=9a2dd79298b655cedacc32c2327b54d21afb51bd;p=lhc%2Fweb%2Fwiklou.git Added percentages to ProfilerSimpleText --- diff --git a/includes/profiler/ProfilerSimpleText.php b/includes/profiler/ProfilerSimpleText.php index 49ad02bc4e..b049d5a139 100644 --- a/includes/profiler/ProfilerSimpleText.php +++ b/includes/profiler/ProfilerSimpleText.php @@ -15,21 +15,23 @@ * @ingroup Profiler */ class ProfilerSimpleText extends ProfilerSimple { - public $visible=false; /* Show as
 or \n";
@@ -38,6 +40,12 @@ class ProfilerSimpleText extends ProfilerSimple {
 	}
 
 	/* dense is good */
-	static function sort($a,$b) { return $a['real']<$b['real']; /* sort descending by time elapsed */ }
-	static function format($item,$key) { self::$out .= sprintf("%3.6f %6d - %s\n",$item['real'],$item['count'], $key); }
+	static function sort( $a, $b ) {
+		return $a['real'] < $b['real']; /* sort descending by time elapsed */
+	}
+
+	static function format( $item, $key, $totalReal ) {
+		self::$out .= sprintf( "%6.2f%% %3.6f %6d - %s\n",
+			$item['real']/$totalReal*100, $item['real'], $item['count'], $key );
+	}
 }