POSIX posix_times

(PHP 4, PHP 5, PHP 7, PHP 8)

posix_times — 처리 시간 가져오기


설명

posix_times(): array|false

현재 CPU 사용량에 대한 정보를 가져옵니다.


매개변수

이 함수에는 매개변수가 없습니다.


반환 값

현재 프로세스 CPU 사용량에 대한 정보가 포함된 문자열 해시를 반환합니다. 해시의 인덱스는 다음과 같습니다.

  • ticks - the number of clock ticks that have elapsed since reboot.
  • utime - user time used by the current process.
  • stime - system time used by the current process.
  • cutime - user time used by current process and children.
  • cstime - system time used by current process and children.

함수는 실패 시 false를 반환합니다.


Examples

예제 #1 posix_times() 사용 예

                  
<?php

$times = posix_times();

print_r($times);
?>
                  
                

위의 예는 다음과 유사한 결과를 출력합니다.

Array
(
    [ticks] => 25814410
    [utime] => 1
    [stime] => 1
    [cutime] => 0
    [cstime] => 0
)
                

메모

경고 이 함수는 사용하기에 신뢰할 수 없으며 높은 시간 동안 음수 값을 반환할 수 있습니다.