mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Scribunto
synced 2024-11-27 17:50:06 +00:00
Allow the profiler to be configured or disabled
Because bugs were found in it. Change-Id: I2737bad8663af3c8afec8a0ea4cca5d0f5b13714
This commit is contained in:
parent
6e3c5da6b8
commit
2b4b42288c
|
@ -112,6 +112,9 @@ $wgScribuntoEngineConf = array(
|
|||
'memoryLimit' => 50 * 1024 * 1024,
|
||||
'cpuLimit' => 7,
|
||||
|
||||
// The profiler sample period, or false to disable the profiler
|
||||
'profilerPeriod' => 0.02,
|
||||
|
||||
// Set this to true to allow setfenv() and getfenv() in user code.
|
||||
// Note that these functions have been removed in Lua 5.2. Scribunto
|
||||
// does not yet support Lua 5.2, but we expect support will be
|
||||
|
|
|
@ -79,9 +79,15 @@ class Scribunto_LuaSandboxInterpreter extends Scribunto_LuaInterpreter {
|
|||
$this->sandbox = new LuaSandbox;
|
||||
$this->sandbox->setMemoryLimit( $options['memoryLimit'] );
|
||||
$this->sandbox->setCPULimit( $options['cpuLimit'] );
|
||||
if ( is_callable( array( $this->sandbox, 'enableProfiler' ) ) ) {
|
||||
$this->profilerEnabled = true;
|
||||
$this->sandbox->enableProfiler( 0.002 );
|
||||
if ( is_callable( array( $this->sandbox, 'enableProfiler' ) ) )
|
||||
{
|
||||
if ( !isset( $options['profilerPeriod'] ) ) {
|
||||
$options['profilerPeriod'] = 0.02;
|
||||
}
|
||||
if ( $options['profilerPeriod'] ) {
|
||||
$this->profilerEnabled = true;
|
||||
$this->sandbox->enableProfiler( $options['profilerPeriod'] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue