mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Scribunto
synced 2024-11-28 10:10:04 +00:00
Merge "Make use of the …::class feature"
This commit is contained in:
commit
ab66a83b81
|
@ -20,6 +20,8 @@
|
||||||
* http://www.gnu.org/copyleft/gpl.html
|
* http://www.gnu.org/copyleft/gpl.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use RunningStat\PSquare;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hooks for the Scribunto extension.
|
* Hooks for the Scribunto extension.
|
||||||
*/
|
*/
|
||||||
|
@ -197,7 +199,7 @@ class ScribuntoHooks {
|
||||||
// observations in APC, and extract the Nth percentile (specified
|
// observations in APC, and extract the Nth percentile (specified
|
||||||
// via $wgScribuntoSlowFunctionThreshold; defaults to 0.90).
|
// via $wgScribuntoSlowFunctionThreshold; defaults to 0.90).
|
||||||
// We need APC and \RunningStat\PSquare to do that.
|
// We need APC and \RunningStat\PSquare to do that.
|
||||||
if ( !class_exists( '\RunningStat\PSquare' ) || $cache instanceof EmptyBagOStuff ) {
|
if ( !class_exists( PSquare::class ) || $cache instanceof EmptyBagOStuff ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -207,7 +209,7 @@ class ScribuntoHooks {
|
||||||
// mutual exclusion, but the only consequence is that some samples
|
// mutual exclusion, but the only consequence is that some samples
|
||||||
// will be dropped. We only need enough samples to estimate the
|
// will be dropped. We only need enough samples to estimate the
|
||||||
// the shape of the data, so that's fine.
|
// the shape of the data, so that's fine.
|
||||||
$ps = $cache->get( $key ) ?: new \RunningStat\PSquare( $threshold );
|
$ps = $cache->get( $key ) ?: new PSquare( $threshold );
|
||||||
$ps->addObservation( $timing );
|
$ps->addObservation( $timing );
|
||||||
$cache->set( $key, $ps, 60 );
|
$cache->set( $key, $ps, 60 );
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue