X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fprofiler%2FProfilerSimple.php;h=1322e47a526c9c3e7573fd752cd73fdce85747bf;hb=d1f8c02d06888a32c82907d354d97dca162d49f6;hp=82197fd4df1346a1605f0073d8381e0d1d653a75;hpb=87505c768d58894730f9c0d313cc68fe398241d6;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/profiler/ProfilerSimple.php b/includes/profiler/ProfilerSimple.php index 82197fd4df..1322e47a52 100644 --- a/includes/profiler/ProfilerSimple.php +++ b/includes/profiler/ProfilerSimple.php @@ -29,9 +29,14 @@ class ProfilerSimple extends Profiler { var $mMinimumTime = 0; - var $zeroEntry = array('cpu'=> 0.0, 'cpu_sq' => 0.0, 'real' => 0.0, 'real_sq' => 0.0, 'count' => 0); + var $zeroEntry = array( 'cpu'=> 0.0, 'cpu_sq' => 0.0, 'real' => 0.0, 'real_sq' => 0.0, 'count' => 0 ); var $errorEntry; + public function isPersistent() { + /* Implement in output subclasses */ + return false; + } + protected function addInitialStack() { $this->errorEntry = $this->zeroEntry; $this->errorEntry['count'] = 1; @@ -52,33 +57,33 @@ class ProfilerSimple extends Profiler { $this->mMinimumTime = $min; } - function profileIn($functionname) { + function profileIn( $functionname ) { global $wgDebugFunctionEntry; - if ($wgDebugFunctionEntry) { - $this->debug(str_repeat(' ', count($this->mWorkStack)).'Entering '.$functionname."\n"); + if ( $wgDebugFunctionEntry ) { + $this->debug( str_repeat( ' ', count( $this->mWorkStack ) ) . 'Entering ' . $functionname . "\n" ); } $this->mWorkStack[] = array( $functionname, count( $this->mWorkStack ), $this->getTime(), $this->getTime( 'cpu' ) ); } - function profileOut($functionname) { + function profileOut( $functionname ) { global $wgDebugFunctionEntry; - if ($wgDebugFunctionEntry) { - $this->debug(str_repeat(' ', count($this->mWorkStack) - 1).'Exiting '.$functionname."\n"); + 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) { - $this->debug("Profiling error: $functionname\n"); + if ( !$ofname ) { + $this->debug( "Profiling error: $functionname\n" ); } else { - if ($functionname == 'close') { + if ( $functionname == 'close' ) { $message = "Profile section ended by close(): {$ofname}"; $functionname = $ofname; $this->debug( "$message\n" ); $this->mCollated[$message] = $this->errorEntry; } - elseif ($ofname != $functionname) { + elseif ( $ofname != $functionname ) { $message = "Profiling error: in({$ofname}), out($functionname)"; $this->debug( "$message\n" ); $this->mCollated[$message] = $this->errorEntry; @@ -86,7 +91,7 @@ class ProfilerSimple extends Profiler { $entry =& $this->mCollated[$functionname]; $elapsedcpu = $this->getTime( 'cpu' ) - $octime; $elapsedreal = $this->getTime() - $ortime; - if (!is_array($entry)) { + if ( !is_array( $entry ) ) { $entry = $this->zeroEntry; $this->mCollated[$functionname] =& $entry; }