From 9a2dd79298b655cedacc32c2327b54d21afb51bd Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Tue, 5 Jul 2011 06:39:07 +0000 Subject: [PATCH] Added percentages to ProfilerSimpleText --- includes/profiler/ProfilerSimpleText.php | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) 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 );
+	}
 }
-- 
2.20.1