From: Max Semenik Date: Fri, 4 Mar 2016 22:41:50 +0000 (-0800) Subject: Instrument diff timing X-Git-Tag: 1.31.0-rc.0~7729^2 X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=f4ad20c1d4a99c4c471e9f841911be1780a6ddd9 Instrument diff timing Bug: T128697 Change-Id: I748286abac025092abc33b3b7b8a0d3dabafdd25 --- diff --git a/includes/diff/DifferenceEngine.php b/includes/diff/DifferenceEngine.php index 1fa19704db..1cf3918a45 100644 --- a/includes/diff/DifferenceEngine.php +++ b/includes/diff/DifferenceEngine.php @@ -842,6 +842,24 @@ class DifferenceEngine extends ContextSource { * @return bool|string */ public function generateTextDiffBody( $otext, $ntext ) { + $time = microtime( true ); + + $result = $this->textDiff( $otext, $ntext ); + + $time = microtime( true ) - $time; + $this->getStats()->timing( 'diff_time', $time ); + + return $result; + } + + /** + * Generates diff, to be wrapped internally in a logging/instrumentation + * + * @param string $otext Old text, must be already segmented + * @param string $ntext New text, must be already segmented + * @return bool|string + */ + protected function textDiff( $otext, $ntext ) { global $wgExternalDiffEngine, $wgContLang; $otext = str_replace( "\r\n", "\n", $otext );