mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Scribunto
synced 2024-09-23 18:30:32 +00:00
Added CPU usage to limit report
Also changed scribunto-lua-in-function-at to not say "anonymous" since it also applies to functions which are not anonymous as declared, only anonymous as called. Change-Id: Ib99cc6d12fbb40a295e1fda35ac48bcf097fdb66
This commit is contained in:
parent
f311f8bc96
commit
35cc7c4630
|
@ -29,7 +29,7 @@ $1',
|
|||
'scribunto-common-backtrace' => 'Backtrace:',
|
||||
'scribunto-lua-in-function' => 'in function "$1"',
|
||||
'scribunto-lua-in-main' => 'in main chunk',
|
||||
'scribunto-lua-in-function-at' => 'in anonymous function at $1:$2',
|
||||
'scribunto-lua-in-function-at' => 'in the function at $1:$2',
|
||||
'scribunto-lua-backtrace-line' => '$1: $2',
|
||||
'scribunto-lua-error-location' => 'Lua error $1: $2',
|
||||
'scribunto-lua-error' => 'Lua error: $2',
|
||||
|
|
|
@ -5,10 +5,10 @@ class Scribunto_LuaSandboxEngine extends Scribunto_LuaEngine {
|
|||
|
||||
public function getLimitReport() {
|
||||
$this->load();
|
||||
$usage = $this->interpreter->getMemoryUsage();
|
||||
$lang = Language::factory( 'en' );
|
||||
$usageStr = $lang->formatSize( $usage );
|
||||
return "Lua memory usage: {$usageStr}\n";
|
||||
return
|
||||
'Lua time usage: ' . sprintf( "%.3f", $this->interpreter->getCPUUsage() ) . "s\n" .
|
||||
'Lua memory usage: ' . $lang->formatSize( $this->interpreter->getMemoryUsage() ) . "\n";
|
||||
}
|
||||
|
||||
function newInterpreter() {
|
||||
|
@ -81,6 +81,10 @@ class Scribunto_LuaSandboxInterpreter extends Scribunto_LuaInterpreter {
|
|||
public function getMemoryUsage() {
|
||||
return $this->sandbox->getMemoryUsage();
|
||||
}
|
||||
|
||||
public function getCPUUsage() {
|
||||
return $this->sandbox->getCPUUsage();
|
||||
}
|
||||
}
|
||||
|
||||
class Scribunto_LuaSandboxCallback {
|
||||
|
|
Loading…
Reference in a new issue