Results of 1 - 10 of about 20 for sandbox (0.004 sec.)
- Pause the CPU usage timer 12473
- « LuaSandbox::loadString LuaSandbox::registerLibrary » PHP Manual LuaSandbox Pause the CPU usage timer 検索 LuaSandbox::pauseUsageTimer (PECL luasandbox >= 1.4.0) LuaSandbox::pauseUsageTimer — Pause the CPU usage timer 説明 public function
... LuaSandbox::pauseUsageTimer (): bool Pauses the CPU usage timer. This only has effect when called from within a callback from Lua. Wh ... り値 Returns a bool indicating whether the timer is now paused. 例 例1 Manipulating the usage timer <?php // create a new LuaSandbox and set a CPU limit $sandbox = new LuaSandbox (); $sandbox -> setCPULimit ( 1 ); function doWait ( $t ) { $end = microtime ... ( true ) + $t ; while ( microtime ( true ) < $end ) { // waste CPU cycles } } // Register a PHP callback $sandbox -> registerLibrary ( 'php' , [ 'test' => function () use ( $sandbox ) { $sandbox -> pauseUsageTimer (); doWait ( 5 ); $san ...
-
https://man.mtool.work/php/8.3/luasandbox.pauseusagetimer.html
- Pause the CPU usage timer 12473
- « LuaSandbox::loadString LuaSandbox::registerLibrary » PHP Manual LuaSandbox Pause the CPU usage timer 検索 LuaSandbox::pauseUsageTimer (PECL luasandbox >= 1.4.0) LuaSandbox::pauseUsageTimer — Pause the CPU usage timer 説明 public function
... LuaSandbox::pauseUsageTimer (): bool Pauses the CPU usage timer. This only has effect when called from within a callback from Lua. Wh ... り値 Returns a bool indicating whether the timer is now paused. 例 例1 Manipulating the usage timer <?php // create a new LuaSandbox and set a CPU limit $sandbox = new LuaSandbox (); $sandbox -> setCPULimit ( 1 ); function doWait ( $t ) { $end = microtime ... ( true ) + $t ; while ( microtime ( true ) < $end ) { // waste CPU cycles } } // Register a PHP callback $sandbox -> registerLibrary ( 'php' , [ 'test' => function () use ( $sandbox ) { $sandbox -> pauseUsageTimer (); doWait ( 5 ); $san ...
-
https://man.mtool.work/php/8.3/luasandbox.pauseusagetimer.html
- Basic usage for LuaSandbox 10553
- « 例 LuaSandbox » PHP Manual 例 Basic usage for LuaSandbox 検索 Basic usage for LuaSandbox Once you've compiled PHP with LuaSandbox support, you can begin using LuaSandbox to safely run user-provided Lua code. 例1 Execute some Lua code <?ph
... p $sandbox = new LuaSandbox ; $sandbox -> setMemoryLimit ( 50 * 1024 * 1024 ); $sandbox -> setCPULimit ( 10 ); // Register some funct ... ions in the Lua environment function frobnosticate ( $v ) { return [ $v + 42 ]; } $sandbox -> registerLibrary ( 'php' , [ 'frobnosticate' => 'frobnosticate' , 'output' => function ( $string ) { echo " $string \n" ... ; }, 'error' => function () { throw new LuaSandboxRuntimeError ( "Something is wrong" ); } ] ); // Execute some Lua code, including callbacks into PHP and into Lua $luaCode ...
-
https://man.mtool.work/php/8.3/luasandbox.examples-basic.html
- Basic usage for LuaSandbox 10485
- « 例 LuaSandbox » PHP Manual 例 Basic usage for LuaSandbox 検索 Basic usage for LuaSandbox Once you've compiled PHP with LuaSandbox support, you can begin using LuaSandbox to safely run user-provided Lua code. 例1 Execute some Lua code <?ph
... p $sandbox = new LuaSandbox ; $sandbox -> setMemoryLimit ( 50 * 1024 * 1024 ); $sandbox -> setCPULimit ( 10 ); // Register some funct ... ions in the Lua environment function frobnosticate ( $v ) { return [ $v + 42 ]; } $sandbox -> registerLibrary ( 'php' , [ 'frobnosticate' => 'frobnosticate' , 'output' => function ( $string ) { echo " $string \n" ... ; }, 'error' => function () { throw new LuaSandboxRuntimeError ( "Something is wrong" ); } ] ); // Execute some Lua code, including callbacks into PHP and into Lua $luaCode ...
-
https://man.mtool.work/php/8.3/luasandbox.examples-basic.html
- Set the memory limit for the Lua environment 8632
- « LuaSandbox::setCPULimit LuaSandbox::unpauseUsageTimer » PHP Manual LuaSandbox Set the memory limit for the Lua environment 検索 LuaSandbox::setMemoryLimit (PECL luasandbox >= 1.0.0) LuaSandbox::setMemoryLimit — Set the memory limit for th
... e Lua environment 説明 public function LuaSandbox::setMemoryLimit ( int $limit ): void Sets the memory limit for the Lua environment. If this limit is exceeded, a LuaSandbo ... wn. パラメータ limit Memory limit in bytes. 戻り値 値を返しません。 例 例1 Calling a Lua function <?php // create a new LuaSandbox $sandbox = new LuaSandbox (); // set a memory limit $sandbox -> setMemoryLimit ( 50 * 1024 * 1024 ); // Run Lua code $sand ... hile true do x = x .. x; end' )-> call (); ?> 上の例の出力は、 たとえば以下のようになります。 PHP Fatal error: Uncaught LuaSandboxMemoryError: not enough memory 参考 LuaSandbox::getMemoryUsage() - Fetch the current memory usage of the Lua environment Lu ...
-
https://man.mtool.work/php/8.3/luasandbox.setmemorylimit.html
- Set the memory limit for the Lua environment 8564
- « LuaSandbox::setCPULimit LuaSandbox::unpauseUsageTimer » PHP Manual LuaSandbox Set the memory limit for the Lua environment 検索 LuaSandbox::setMemoryLimit (PECL luasandbox >= 1.0.0) LuaSandbox::setMemoryLimit — Set the memory limit for th
... e Lua environment 説明 public function LuaSandbox::setMemoryLimit ( int $limit ): void Sets the memory limit for the Lua environment. If this limit is exceeded, a LuaSandbo ... wn. パラメータ limit Memory limit in bytes. 戻り値 値を返しません。 例 例1 Calling a Lua function <?php // create a new LuaSandbox $sandbox = new LuaSandbox (); // set a memory limit $sandbox -> setMemoryLimit ( 50 * 1024 * 1024 ); // Run Lua code $sand ... hile true do x = x .. x; end' )-> call (); ?> 上の例の出力は、 たとえば以下のようになります。 PHP Fatal error: Uncaught LuaSandboxMemoryError: not enough memory 参考 LuaSandbox::getMemoryUsage() - Fetch the current memory usage of the Lua environment Lu ...
-
https://man.mtool.work/php/8.3/luasandbox.setmemorylimit.html
- Fetch profiler data 8513
- « LuaSandbox::getPeakMemoryUsage LuaSandbox::getVersionInfo » PHP Manual LuaSandbox Fetch profiler data 検索 LuaSandbox::getProfilerFunctionReport (PECL luasandbox >= 1.1.0) LuaSandbox::getProfilerFunctionReport — Fetch profiler data 説明 p
... ublic function LuaSandbox::getProfilerFunctionReport ( int $units = LuaSandbox::SECONDS ): array For a profiling instance previously started by LuaS ... et a report of the cost of each function. The measurement unit used for the cost is determined by the $units parameter: LuaSandbox::SAMPLES Measure in number of samples. LuaSandbox::SECONDS Measure in seconds of CPU time. LuaSandbox::PERCENT Measure per ... X, this function will report the elapsed wall-clock time, not CPU time. 例 例1 Profiling Lua code <?php // create a new LuaSandbox $sandbox = new LuaSandbox (); // Start the profiler $sandbox -> enableProfiler ( 0.01 ); // ... Execute some Lua code here ...
-
https://man.mtool.work/php/8.3/luasandbox.getprofilerfunctionreport.html
- Fetch profiler data 8462
- « LuaSandbox::getPeakMemoryUsage LuaSandbox::getVersionInfo » PHP Manual LuaSandbox Fetch profiler data 検索 LuaSandbox::getProfilerFunctionReport (PECL luasandbox >= 1.1.0) LuaSandbox::getProfilerFunctionReport — Fetch profiler data 説明 p
... ublic function LuaSandbox::getProfilerFunctionReport ( int $units = LuaSandbox::SECONDS ): array For a profiling instance previously started by LuaS ... et a report of the cost of each function. The measurement unit used for the cost is determined by the $units parameter: LuaSandbox::SAMPLES Measure in number of samples. LuaSandbox::SECONDS Measure in seconds of CPU time. LuaSandbox::PERCENT Measure per ... X, this function will report the elapsed wall-clock time, not CPU time. 例 例1 Profiling Lua code <?php // create a new LuaSandbox $sandbox = new LuaSandbox (); // Start the profiler $sandbox -> enableProfiler ( 0.01 ); // ... Execute some Lua code here ...
-
https://man.mtool.work/php/8.3/luasandbox.getprofilerfunctionreport.html
- Set the CPU time limit for the Lua environment 8343
- « LuaSandbox::registerLibrary LuaSandbox::setMemoryLimit » PHP Manual LuaSandbox Set the CPU time limit for the Lua environment 検索 LuaSandbox::setCPULimit (PECL luasandbox >= 1.0.0) LuaSandbox::setCPULimit — Set the CPU time limit for the
... Lua environment 説明 public function LuaSandbox::setCPULimit ( float | bool $limit ): void Sets the CPU time limit for the Lua environment. If the total user and system t ... ime used by the environment after the call to this method exceeds this limit, a LuaSandboxTimeoutError exception is thrown. Time used in PHP callbacks is included in the limit. Setting the time limit from a callba ... a float in seconds, or false for no limit. 戻り値 値を返しません。 例 例1 Calling a Lua function <?php // create a new LuaSandbox $sandbox = new LuaSandbox (); // set a time limit $sandbox -> setCPULimit ( 2 ); // Run Lua code $sandbox -> loadString ( ...
-
https://man.mtool.work/php/8.3/luasandbox.setcpulimit.html
- Set the CPU time limit for the Lua environment 8292
- « LuaSandbox::registerLibrary LuaSandbox::setMemoryLimit » PHP Manual LuaSandbox Set the CPU time limit for the Lua environment 検索 LuaSandbox::setCPULimit (PECL luasandbox >= 1.0.0) LuaSandbox::setCPULimit — Set the CPU time limit for the
... Lua environment 説明 public function LuaSandbox::setCPULimit ( float | bool $limit ): void Sets the CPU time limit for the Lua environment. If the total user and system t ... ime used by the environment after the call to this method exceeds this limit, a LuaSandboxTimeoutError exception is thrown. Time used in PHP callbacks is included in the limit. Setting the time limit from a callba ... a float in seconds, or false for no limit. 戻り値 値を返しません。 例 例1 Calling a Lua function <?php // create a new LuaSandbox $sandbox = new LuaSandbox (); // set a time limit $sandbox -> setCPULimit ( 2 ); // Run Lua code $sandbox -> loadString ( ...
-
https://man.mtool.work/php/8.3/luasandbox.setcpulimit.html