From: Aaron Schulz Date: Sat, 9 May 2015 18:42:14 +0000 (-0700) Subject: Added explicit profile sections to JobRunner X-Git-Tag: 1.31.0-rc.0~11429 X-Git-Url: https://git.cyclocoop.org/%242?a=commitdiff_plain;h=dc6a4d27deb3ed3343b023d4a8cfde854f3b69aa;p=lhc%2Fweb%2Fwiklou.git Added explicit profile sections to JobRunner Change-Id: Iba60204e1ab7c81686f05b36661080c000b10157 --- diff --git a/includes/jobqueue/JobRunner.php b/includes/jobqueue/JobRunner.php index f413701ed3..e84c17b727 100644 --- a/includes/jobqueue/JobRunner.php +++ b/includes/jobqueue/JobRunner.php @@ -118,8 +118,10 @@ class JobRunner implements LoggerAwareInterface { return $response; } + $profiler = Profiler::instance(); + // Catch huge single updates that lead to slave lag - $trxProfiler = Profiler::instance()->getTransactionProfiler(); + $trxProfiler = $profiler->getTransactionProfiler(); $trxProfiler->setLogger( LoggerFactory::getInstance( 'DBPerformance' ) ); $trxProfiler->setExpectations( $wgTrxProfilerLimits['JobRunner'], __METHOD__ ); @@ -179,6 +181,7 @@ class JobRunner implements LoggerAwareInterface { $this->debugCallback( $msg ); // Run the job... + $psection = $profiler->scopedProfileIn( __METHOD__ . '-' . $jType ); $jobStartTime = microtime( true ); try { ++$jobsRun; @@ -193,6 +196,7 @@ class JobRunner implements LoggerAwareInterface { } $timeMs = intval( ( microtime( true ) - $jobStartTime ) * 1000 ); $timeMsTotal += $timeMs; + $profiler->scopedProfileOut( $psection ); // Mark the job as done on success or when the job cannot be retried if ( $status !== false || !$job->allowRetries() ) {