* @todo document
*/
function mergeChangesInto( &$editText ){
+ $fname = 'EditPage::mergeChangesInto';
+ wfProfileIn( $fname );
+
$db =& wfGetDB( DB_MASTER );
// This is the revision the editor started from
$baseRevision = Revision::loadFromTimestamp(
$db, $this->mArticle->mTitle, $this->edittime );
if( is_null( $baseRevision ) ) {
+ wfProfileOut( $fname );
return false;
}
$baseText = $baseRevision->getText();
$currentRevision = Revision::loadFromTitle(
$db, $this->mArticle->mTitle );
if( is_null( $currentRevision ) ) {
+ wfProfileOut( $fname );
return false;
}
$currentText = $currentRevision->getText();
if( wfMerge( $baseText, $editText, $currentText, $result ) ){
$editText = $result;
+ wfProfileOut( $fname );
return true;
} else {
+ wfProfileOut( $fname );
return false;
}
}
if ($wgDebugFunctionEntry && function_exists('wfDebug')) {
wfDebug(str_repeat(' ', count($this->mWorkStack)).'Entering '.$functionname."\n");
}
- $this->mWorkStack[] = array($functionname, count($this->mWorkStack), microtime(), memory_get_usage());
- #$this->mWorkStack[] = array($functionname, count( $this->mWorkStack ), $this->getUserTime(), memory_get_usage());
+ $this->mWorkStack[] = array($functionname, count( $this->mWorkStack ), $this->getTime(), memory_get_usage());
}
function profileOut($functionname) {
$memory = memory_get_usage();
- $time = microtime();
- #$time = $this->getUserTime();
+ $time = $this->getTime();
global $wgDebugProfiling, $wgDebugFunctionEntry;
if (!$bit) {
wfDebug("Profiling error, !\$bit: $functionname\n");
} else {
- if ($wgDebugProfiling) {
+ //if ($wgDebugProfiling) {
if ($functionname == 'close') {
- wfDebug("Profile section ended by close(): {$bit[0]}\n");
+ $message = "Profile section ended by close(): {$bit[0]}\n";
+ wfDebug( $message );
+ $this->mStack[] = array( $message, 0, 0, 0 );
}
elseif ($bit[0] != $functionname) {
- wfDebug("Profiling error: in({$bit[0]}), out($functionname)\n");
+ $message = "Profiling error: in({$bit[0]}), out($functionname)\n";
+ wfDebug( $message );
+ $this->mStack[] = array( $message, 0, 0, 0 );
}
- }
+ //}
$bit[] = $time;
$bit[] = $memory;
$this->mStack[] = $bit;
$this->micro2Float( $start );
}
+ function getTime() {
+ return microtime();
+ #return $this->getUserTime();
+ }
+
function getUserTime() {
$ru = getrusage();
return $ru['ru_utime.tv_sec'].' '.$ru['ru_utime.tv_usec'] / 1e6;