X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Fprofiler%2FTransactionProfiler.php;h=bf26573cc30a0357af2172c6fbbcde6a5e538a74;hb=47437e0653542aae57ea456b24486efb48ee8aac;hp=1aba71c3fa0291e1aa7e37336c0490dd00678a19;hpb=e3bd13db0c285f312e31bb1b7271af4628cca80c;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/profiler/TransactionProfiler.php b/includes/profiler/TransactionProfiler.php index 1aba71c3fa..bf26573cc3 100644 --- a/includes/profiler/TransactionProfiler.php +++ b/includes/profiler/TransactionProfiler.php @@ -38,6 +38,8 @@ class TransactionProfiler implements LoggerAwareInterface { protected $dbLockThreshold = 3.0; /** @var float Seconds */ protected $eventThreshold = .25; + /** @var bool */ + protected $silenced = false; /** @var array transaction ID => (write start time, list of DBs involved) */ protected $dbTrxHoldingLocks = []; @@ -77,6 +79,14 @@ class TransactionProfiler implements LoggerAwareInterface { $this->logger = $logger; } + /** + * @param bool $value + * @since 1.28 + */ + public function setSilenced( $value ) { + $this->silenced = $value; + } + /** * Set performance expectations * @@ -302,6 +312,10 @@ class TransactionProfiler implements LoggerAwareInterface { * @param string|float|int $actual [optional] */ protected function reportExpectationViolated( $expect, $query, $actual = null ) { + if ( $this->silenced ) { + return; + } + $n = $this->expect[$expect]; $by = $this->expectBy[$expect]; $actual = ( $actual !== null ) ? " (actual: $actual)" : "";