trace .= " " . sprintf( "%6.1f", $this->memoryDiff() ) . str_repeat( " ", count( $this->mWorkStack ) ) . " > " . $functionname . "\n"; } function profileOut( $functionname ) { global $wgDebugFunctionEntry; if ( $wgDebugFunctionEntry ) { $this->debug( str_repeat( ' ', count( $this->mWorkStack ) - 1 ) . 'Exiting ' . $functionname . "\n" ); } list( $ofname, /* $ocount */, $ortime ) = array_pop( $this->mWorkStack ); if ( !$ofname ) { $this->trace .= "Profiling error: $functionname\n"; } else { if ( $functionname == 'close' ) { $message = "Profile section ended by close(): {$ofname}"; $functionname = $ofname; $this->trace .= $message . "\n"; } elseif ( $ofname != $functionname ) { $this->trace .= "Profiling error: in({$ofname}), out($functionname)"; } $elapsedreal = $this->getTime() - $ortime; $this->trace .= sprintf( "%03.6f %6.1f", $elapsedreal, $this->memoryDiff() ) . str_repeat( " ", count( $this->mWorkStack ) + 1 ) . " < " . $functionname . "\n"; $this->updateTrxProfiling( $functionname, $elapsedreal ); } } function memoryDiff() { $diff = memory_get_usage() - $this->memory; $this->memory = memory_get_usage(); return $diff / 1024; } function logData() { if ( PHP_SAPI === 'cli' ) { print ""; } elseif ( $this->getContentType() === 'text/html' ) { print ""; } elseif ( $this->getContentType() === 'text/javascript' ) { print "\n/*\n {$this->trace}\n*/"; } elseif ( $this->getContentType() === 'text/css' ) { print "\n/*\n {$this->trace}\n*/"; } } }