Ori.livneh has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/249337

Change subject: Add `getMemoryUsage` and `getCPUUsage` to LuaInterpreter 
abstract class
......................................................................

Add `getMemoryUsage` and `getCPUUsage` to LuaInterpreter abstract class

The abstract class already declares unpause / pauseUsageTimer(), so it makes
sense for it to declare these two methods as well (which are provided by
LuaSandbox). LuaStandaloneInterpreter could implement these in the future, but
for now both methods simply return false to indicate that the interpreter does
not support this feature.

Change-Id: I6a4ed03c1261f43a7ce7de6f274c32c450e66abb
---
M engines/LuaCommon/LuaInterpreter.php
M engines/LuaStandalone/LuaStandaloneEngine.php
2 files changed, 24 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Scribunto 
refs/changes/37/249337/1

diff --git a/engines/LuaCommon/LuaInterpreter.php 
b/engines/LuaCommon/LuaInterpreter.php
index c9e0eff..d94823c 100644
--- a/engines/LuaCommon/LuaInterpreter.php
+++ b/engines/LuaCommon/LuaInterpreter.php
@@ -57,6 +57,22 @@
         * @return void
         */
        abstract public function unpauseUsageTimer();
+
+       /**
+        * Get peak memory usage
+        *
+        * @return int|boolean Peak memory usage in bytes, or false if not
+        *  available or not implemented.
+        */
+       abstract public function getPeakMemoryUsage();
+
+       /**
+        * Get CPU usage
+        *
+        * @return float|boolean CPU time in fractional seconds, or false
+        *  if not available or not implemented.
+        */
+       abstract public function getCPUUsage();
 }
 
 class Scribunto_LuaInterpreterNotFoundError extends MWException {}
diff --git a/engines/LuaStandalone/LuaStandaloneEngine.php 
b/engines/LuaStandalone/LuaStandaloneEngine.php
index 4202d25..a0af3db 100644
--- a/engines/LuaStandalone/LuaStandaloneEngine.php
+++ b/engines/LuaStandalone/LuaStandaloneEngine.php
@@ -279,6 +279,14 @@
                $this->terminate();
        }
 
+       public function getPeakMemoryUsage() {
+               return false;  // not implemented.
+       }
+
+       public function getCPUUsage() {
+               return false;  // not implemented.
+       }
+
        public static function getLuaVersion( array $options ) {
                if ( $options['luaPath'] === null ) {
                        // We know which versions are distributed, no need to 
run them.

-- 
To view, visit https://gerrit.wikimedia.org/r/249337
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6a4ed03c1261f43a7ce7de6f274c32c450e66abb
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Scribunto
Gerrit-Branch: master
Gerrit-Owner: Ori.livneh <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to