Log slow diffs
authorMax Semenik <maxsem.wiki@gmail.com>
Fri, 11 Mar 2016 21:11:43 +0000 (13:11 -0800)
committerMax Semenik <maxsem.wiki@gmail.com>
Fri, 11 Mar 2016 21:11:43 +0000 (13:11 -0800)
Change-Id: Id17e116cd58d433bf6bb51c38096727a660135b9

includes/diff/DifferenceEngine.php

index a1a1bb0..f2630d9 100644 (file)
@@ -846,8 +846,13 @@ class DifferenceEngine extends ContextSource {
 
                $result = $this->textDiff( $otext, $ntext );
 
-               $time = microtime( true ) - $time;
-               $this->getStats()->timing( 'diff_time', $time * 1000 );
+               $time = intval( ( microtime( true ) - $time ) * 1000 );
+               $this->getStats()->timing( 'diff_time', $time );
+               // Log requests slower than 99th percentile
+               if ( $time > 100 && $this->mOldPage && $this->mNewPage ) {
+                       wfDebugLog( 'diff',
+                               "$time ms diff: {$this->mOldid} -> {$this->mNewid} {$this->mNewPage}" );
+               }
 
                return $result;
        }