« LuaSandbox::getPeakMemoryUsage
LuaSandbox::getVersionInfo »

LuaSandbox::getProfilerFunctionReport

(PECL luasandbox >= 1.1.0)

LuaSandbox::getProfilerFunctionReport — Fetch profiler data

説明

public function LuaSandbox::getProfilerFunctionReport(int $units = LuaSandbox::SECONDS): array

For a profiling instance previously started by LuaSandbox::enableProfiler(), get 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 percentage of CPU time.

パラメータ

units

Measurement unit constant.

戻り値

Returns profiler measurements, sorted in descending order, as an associative array. Keys are the Lua function names (with source file and line defined in angle brackets), values are the measurements as int or float.

注意:

On Windows, this function always returns an empty array. On operating systems that do not support CLOCK_THREAD_CPUTIME_ID, such as FreeBSD and Mac OS 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 ...

// Fetch the profiler data
$data = $sandbox->getProfilerFunctionReport();

?>
関連キーワード:
LuaSandbox   profiler   Fetch   getProfilerFunctionReport   units   sandbox   enableProfiler   cost   unit   code   getPeakMemoryUsage   getVersionInfo   luasandbox   profiling   instance   started   measurement   parameter   number   seconds   Measurement   constant   sorted   descending   order
関連する関数・ページ:
luasandbox.disableprofiler   luasandbox.enableprofiler   luasandbox.setup   class.luasandbox   luasandbox.getversioninfo   luasandbox.examples