r77492 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r77491‎ | r77492 | r77493 >
Date:18:33, 30 November 2010
Author:reedy
Status:ok
Tags:
Comment:
Remove a couple of unused variables, add spaces, wrap some long lines
Modified paths:
  • /trunk/phase3/includes/ProfilerSimpleTrace.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/ProfilerSimpleTrace.php
@@ -21,49 +21,48 @@
2222
2323 function __construct() {
2424 global $wgRequestTime, $wgRUstart;
25 - if (!empty($wgRequestTime) && !empty($wgRUstart)) {
26 - $this->mWorkStack[] = array( '-total', 0, $wgRequestTime,$this->getCpuTime($wgRUstart));
27 - $elapsedcpu = $this->getCpuTime() - $this->getCpuTime($wgRUstart);
28 - $elapsedreal = microtime(true) - $wgRequestTime;
 25+ if ( !empty( $wgRequestTime ) && !empty( $wgRUstart ) ) {
 26+ $this->mWorkStack[] = array( '-total', 0, $wgRequestTime, $this->getCpuTime( $wgRUstart ) );
2927 }
3028 $this->trace .= "Beginning trace: \n";
3129 }
3230
3331 function profileIn($functionname) {
3432 $this->mWorkStack[] = array($functionname, count( $this->mWorkStack ), microtime(true), $this->getCpuTime());
35 - $this->trace .= " " . sprintf("%6.1f",$this->memoryDiff()) . str_repeat( " ", count($this->mWorkStack)) . " > " . $functionname . "\n";
 33+ $this->trace .= " " . sprintf("%6.1f",$this->memoryDiff()) .
 34+ str_repeat( " ", count($this->mWorkStack)) . " > " . $functionname . "\n";
3635 }
3736
3837 function profileOut($functionname) {
3938 global $wgDebugFunctionEntry;
4039
41 - if ($wgDebugFunctionEntry) {
 40+ if ( $wgDebugFunctionEntry ) {
4241 $this->debug(str_repeat(' ', count($this->mWorkStack) - 1).'Exiting '.$functionname."\n");
4342 }
4443
45 - list($ofname, /* $ocount */ ,$ortime,$octime) = array_pop($this->mWorkStack);
 44+ list( $ofname, /* $ocount */ , $ortime, $octime ) = array_pop( $this->mWorkStack );
4645
47 - if (!$ofname) {
 46+ if ( !$ofname ) {
4847 $this->trace .= "Profiling error: $functionname\n";
4948 } else {
50 - if ($functionname == 'close') {
 49+ if ( $functionname == 'close' ) {
5150 $message = "Profile section ended by close(): {$ofname}";
5251 $functionname = $ofname;
5352 $this->trace .= $message . "\n";
5453 }
55 - elseif ($ofname != $functionname) {
 54+ elseif ( $ofname != $functionname ) {
5655 $this->trace .= "Profiling error: in({$ofname}), out($functionname)";
5756 }
58 - $elapsedcpu = $this->getCpuTime() - $octime;
59 - $elapsedreal = microtime(true) - $ortime;
60 - $this->trace .= sprintf("%03.6f %6.1f",$elapsedreal,$this->memoryDiff()) . str_repeat(" ",count($this->mWorkStack)+1) . " < " . $functionname . "\n";
 57+ $elapsedreal = microtime( true ) - $ortime;
 58+ $this->trace .= sprintf( "%03.6f %6.1f", $elapsedreal, $this->memoryDiff() ) .
 59+ str_repeat(" ", count( $this->mWorkStack ) + 1 ) . " < " . $functionname . "\n";
6160 }
6261 }
6362
6463 function memoryDiff() {
6564 $diff = memory_get_usage() - $this->memory;
6665 $this->memory = memory_get_usage();
67 - return $diff/1024;
 66+ return $diff / 1024;
6867 }
6968
7069 function getOutput() {

Status & tagging log