LuaSandbox LuaSandbox::getProfilerFunctionReport
(PECL luasandbox >= 1.1.0)
LuaSandbox::getProfilerFunctionReport — 프로파일러 데이터 가져오기
설명
public LuaSandbox::getProfilerFunctionReport(int $units
= LuaSandbox::SECONDS): array
이전에 LuaSandbox::enableProfiler()에 의해 시작된 프로파일링 인스턴스의 경우 각 함수의 비용 보고서를 가져옵니다.
비용에 사용되는 측정 단위는 $units 매개변수에 의해 결정됩니다.
LuaSandbox::SAMPLES
- 샘플 수로 측정합니다.
LuaSandbox::SECONDS
- CPU 시간의 초 단위로 측정합니다.
LuaSandbox::PERCENT
- CPU 시간의 백분율을 측정합니다.
매개변수
units
- 측정 단위 상수입니다.
반환 값
내림차순으로 정렬된 프로파일러 측정값을 연관 배열로 반환합니다. 키는 Lua 함수 이름(각괄호로 정의된 소스 파일 및 라인 포함)이고, 값은 int 또는 float로 측정됩니다.
메모:
Windows에서 이 함수는 항상 빈 배열을 반환합니다. FreeBSD 및 Mac OS X와 같이 CLOCK_THREAD_CPUTIME_ID
를 지원하지 않는 운영 체제에서 이 함수는 CPU 시간이 아니라 경과된 벽시계 시간을 보고합니다.
Examples
예제 #1 Lua 코드 프로파일링
<?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();
?>