From 526fd17ca76fcdf283fdf00837d50534045eb411 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Tue, 6 Dec 2005 13:08:51 +0000 Subject: [PATCH] Measurement of the pre-profile setup time --- includes/Profiling.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/includes/Profiling.php b/includes/Profiling.php index 8bb794589a..6dc007cb48 100755 --- a/includes/Profiling.php +++ b/includes/Profiling.php @@ -44,14 +44,19 @@ if (!function_exists('memory_get_usage')) { class Profiler { var $mStack = array (), $mWorkStack = array (), $mCollated = array (); var $mCalls = array (), $mTotals = array (); - /* + function Profiler() { - $this->mProfileStack = array(); - $this->mWorkStack = array(); - $this->mCollated = array(); + // Push an entry for the pre-profile setup time onto the stack + global $wgRequestTime; + if ( !empty( $wgRequestTime ) ) { + $this->mWorkStack[] = array( '-total', 0, $wgRequestTime, 0 ); + $this->mStack[] = array( '-setup', 1, $wgRequestTime, 0, microtime(), 0 ); + } else { + $this->profileIn( '-total' ); + } + } - */ function profileIn($functionname) { global $wgDebugFunctionEntry; @@ -349,5 +354,5 @@ class Profiler { } $wgProfiler = new Profiler(); -$wgProfiler->profileIn('-total'); + ?> -- 2.20.1