$bit = array_pop( $this->mWorkStack );
if ( !$bit ) {
- $this->debug( "Profiling error, !\$bit: $functionname\n" );
+ $this->debugGroup( 'profileerror', "Profiling error, !\$bit: $functionname" );
} else {
if ( $functionname == 'close' ) {
- $message = "Profile section ended by close(): {$bit[0]}";
- $this->debug( "$message\n" );
- $this->mStack[] = array( $message, 0, 0.0, 0, 0.0, 0 );
+ if ( $bit[0] != '-total' ) {
+ $message = "Profile section ended by close(): {$bit[0]}";
+ $this->debugGroup( 'profileerror', $message );
+ $this->mStack[] = array( $message, 0, 0.0, 0, 0.0, 0 );
+ }
} elseif ( $bit[0] != $functionname ) {
$message = "Profiling error: in({$bit[0]}), out($functionname)";
- $this->debug( "$message\n" );
+ $this->debugGroup( 'profileerror', $message );
$this->mStack[] = array( $message, 0, 0.0, 0, 0.0, 0 );
}
$bit[] = $time;
list( $method, $realtime ) = $info;
$msg .= sprintf( "%d\t%.6f\t%s\n", $i, $realtime, $method );
}
- wfDebugLog( 'DBPerformance', $msg );
+ $this->debugGroup( 'DBPerformance', $msg );
}
unset( $this->mDBTrxHoldingLocks[$name] );
unset( $this->mDBTrxMethodTimes[$name] );
}
}
+ /**
+ * Add an entry in the debug log group
+ *
+ * @param string $group Group to send the message to
+ * @param string $s to output
+ */
+ function debugGroup( $group, $s ) {
+ if ( function_exists( 'wfDebugLog' ) ) {
+ wfDebugLog( $group, $s );
+ }
+ }
+
/**
* Get the content type sent out to the client.
* Used for profilers that output instead of store data.
list( $ofname, /* $ocount */, $ortime, $octime ) = array_pop( $this->mWorkStack );
if ( !$ofname ) {
- $this->debug( "Profiling error: $functionname\n" );
+ $this->debugGroup( 'profileerror', "Profiling error: $functionname" );
} else {
if ( $functionname == 'close' ) {
- $message = "Profile section ended by close(): {$ofname}";
- $functionname = $ofname;
- $this->debug( "$message\n" );
- $this->mCollated[$message] = $this->errorEntry;
- }
- elseif ( $ofname != $functionname ) {
+ if ( $ofname != '-total' ) {
+ $message = "Profile section ended by close(): {$ofname}";
+ $functionname = $ofname;
+ $this->debugGroup( 'profileerror', $message );
+ $this->mCollated[$message] = $this->errorEntry;
+ }
+ } elseif ( $ofname != $functionname ) {
$message = "Profiling error: in({$ofname}), out($functionname)";
- $this->debug( "$message\n" );
+ $this->debugGroup( 'profileerror', $message );
$this->mCollated[$message] = $this->errorEntry;
}
$elapsedcpu = $this->getTime( 'cpu' ) - $octime;