From 9db190c7e736ec8d063187d4241b59feaf7dc2d1 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Wed, 22 Jun 2011 11:28:20 +0200 Subject: update to MediaWiki 1.17.0 --- includes/ProfilerSimpleTrace.php | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) (limited to 'includes/ProfilerSimpleTrace.php') diff --git a/includes/ProfilerSimpleTrace.php b/includes/ProfilerSimpleTrace.php index 63119228..8f6a2a1c 100644 --- a/includes/ProfilerSimpleTrace.php +++ b/includes/ProfilerSimpleTrace.php @@ -21,50 +21,48 @@ class ProfilerSimpleTrace extends ProfilerSimple { function __construct() { global $wgRequestTime, $wgRUstart; - if (!empty($wgRequestTime) && !empty($wgRUstart)) { - $this->mWorkStack[] = array( '-total', 0, $wgRequestTime,$this->getCpuTime($wgRUstart)); - $elapsedcpu = $this->getCpuTime() - $this->getCpuTime($wgRUstart); - $elapsedreal = microtime(true) - $wgRequestTime; + if ( !empty( $wgRequestTime ) && !empty( $wgRUstart ) ) { + $this->mWorkStack[] = array( '-total', 0, $wgRequestTime, $this->getCpuTime( $wgRUstart ) ); } $this->trace .= "Beginning trace: \n"; } function profileIn($functionname) { - global $wgDebugFunctionEntry; $this->mWorkStack[] = array($functionname, count( $this->mWorkStack ), microtime(true), $this->getCpuTime()); - $this->trace .= " " . sprintf("%6.1f",$this->memoryDiff()) . str_repeat( " ", count($this->mWorkStack)) . " > " . $functionname . "\n"; + $this->trace .= " " . sprintf("%6.1f",$this->memoryDiff()) . + str_repeat( " ", count($this->mWorkStack)) . " > " . $functionname . "\n"; } function profileOut($functionname) { global $wgDebugFunctionEntry; - if ($wgDebugFunctionEntry) { + if ( $wgDebugFunctionEntry ) { $this->debug(str_repeat(' ', count($this->mWorkStack) - 1).'Exiting '.$functionname."\n"); } - list($ofname, /* $ocount */ ,$ortime,$octime) = array_pop($this->mWorkStack); + list( $ofname, /* $ocount */ , $ortime, $octime ) = array_pop( $this->mWorkStack ); - if (!$ofname) { + if ( !$ofname ) { $this->trace .= "Profiling error: $functionname\n"; } else { - if ($functionname == 'close') { + if ( $functionname == 'close' ) { $message = "Profile section ended by close(): {$ofname}"; $functionname = $ofname; $this->trace .= $message . "\n"; } - elseif ($ofname != $functionname) { - $self->trace .= "Profiling error: in({$ofname}), out($functionname)"; + elseif ( $ofname != $functionname ) { + $this->trace .= "Profiling error: in({$ofname}), out($functionname)"; } - $elapsedcpu = $this->getCpuTime() - $octime; - $elapsedreal = microtime(true) - $ortime; - $this->trace .= sprintf("%03.6f %6.1f",$elapsedreal,$this->memoryDiff()) . str_repeat(" ",count($this->mWorkStack)+1) . " < " . $functionname . "\n"; + $elapsedreal = microtime( true ) - $ortime; + $this->trace .= sprintf( "%03.6f %6.1f", $elapsedreal, $this->memoryDiff() ) . + str_repeat(" ", count( $this->mWorkStack ) + 1 ) . " < " . $functionname . "\n"; } } function memoryDiff() { $diff = memory_get_usage() - $this->memory; $this->memory = memory_get_usage(); - return $diff/1024; + return $diff / 1024; } function getOutput() { -- cgit v1.2.3-54-g00ecf