summaryrefslogtreecommitdiff
path: root/includes/profiler/ProfilerSimpleTrace.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2013-08-12 09:28:15 +0200
committerPierre Schmitz <pierre@archlinux.de>2013-08-12 09:28:15 +0200
commit08aa4418c30cfc18ccc69a0f0f9cb9e17be6c196 (patch)
tree577a29fb579188d16003a209ce2a2e9c5b0aa2bd /includes/profiler/ProfilerSimpleTrace.php
parentcacc939b34e315b85e2d72997811eb6677996cc1 (diff)
Update to MediaWiki 1.21.1
Diffstat (limited to 'includes/profiler/ProfilerSimpleTrace.php')
-rw-r--r--includes/profiler/ProfilerSimpleTrace.php22
1 files changed, 15 insertions, 7 deletions
diff --git a/includes/profiler/ProfilerSimpleTrace.php b/includes/profiler/ProfilerSimpleTrace.php
index 822e9fe4..d44dfe1b 100644
--- a/includes/profiler/ProfilerSimpleTrace.php
+++ b/includes/profiler/ProfilerSimpleTrace.php
@@ -32,18 +32,18 @@ class ProfilerSimpleTrace extends ProfilerSimple {
function profileIn( $functionname ) {
parent::profileIn( $functionname );
- $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) {
+ function profileOut( $functionname ) {
global $wgDebugFunctionEntry;
if ( $wgDebugFunctionEntry ) {
- $this->debug(str_repeat(' ', count($this->mWorkStack) - 1).'Exiting '.$functionname."\n");
+ $this->debug( str_repeat( ' ', count( $this->mWorkStack ) - 1 ) . 'Exiting ' . $functionname . "\n" );
}
- list( $ofname, /* $ocount */ , $ortime ) = array_pop( $this->mWorkStack );
+ list( $ofname, /* $ocount */, $ortime ) = array_pop( $this->mWorkStack );
if ( !$ofname ) {
$this->trace .= "Profiling error: $functionname\n";
@@ -58,7 +58,7 @@ class ProfilerSimpleTrace extends ProfilerSimple {
}
$elapsedreal = $this->getTime() - $ortime;
$this->trace .= sprintf( "%03.6f %6.1f", $elapsedreal, $this->memoryDiff() ) .
- str_repeat(" ", count( $this->mWorkStack ) + 1 ) . " < " . $functionname . "\n";
+ str_repeat( " ", count( $this->mWorkStack ) + 1 ) . " < " . $functionname . "\n";
}
}
@@ -69,6 +69,14 @@ class ProfilerSimpleTrace extends ProfilerSimple {
}
function logData() {
- print "<!-- \n {$this->trace} \n -->";
+ if ( PHP_SAPI === 'cli' ) {
+ print "<!-- \n {$this->trace} \n -->";
+ } elseif ( $this->getContentType() === 'text/html' ) {
+ print "<!-- \n {$this->trace} \n -->";
+ } elseif ( $this->getContentType() === 'text/javascript' ) {
+ print "\n/*\n {$this->trace}\n*/";
+ } elseif ( $this->getContentType() === 'text/css' ) {
+ print "\n/*\n {$this->trace}\n*/";
+ }
}
}