getrusage

(PHP 4, PHP 5, PHP 7)

getrusage��ȡ��ǰ��Դʹ��״��

˵��

getrusage ([ int $who = 0 ] ) : array

���� getrusage(2) �Ľӿڡ��������˵�����ϵͳ�����ݡ�

����

who

��� who �� 1��getrusage ��ʹ�� RUSAGE_CHILDREN �����á�

����ֵ

������һ������ϵͳ�������ݵĹ������顣������Ŀ����ͨ���ĵ����ֶε����������ʡ�

����

Example #1 getrusage() ����

<?php
$dat 
getrusage();
echo 
$dat["ru_nswap"];         // number of swaps
echo $dat["ru_majflt"];        // number of page faults
echo $dat["ru_utime.tv_sec"];  // user time used (seconds)
echo $dat["ru_utime.tv_usec"]; // user time used (microseconds)
?>

������־

�汾 ˵��
7.0.0 �˺������ڿ�ʼ֧�� Windows��

ע��

Note:

�� Windows �� getrusage() ���᷵���������ͣ�

  • "ru_stime.tv_sec"
  • "ru_stime.tv_usec"
  • "ru_utime.tv_sec"
  • "ru_utime.tv_usec"
  • "ru_majflt" (only if who is RUSAGE_SELF)
  • "ru_maxrss" (only if who is RUSAGE_SELF)

If getrusage() is called with who set to 1 (RUSAGE_CHILDREN), then resource usage for threads are collected (meaning that internally the function is called with RUSAGE_THREAD).

Note:

�� BeOS 2000�����᷵���������ͣ�

  • "ru_stime.tv_sec"
  • "ru_stime.tv_usec"
  • "ru_utime.tv_sec"
  • "ru_utime.tv_usec"

�μ�

  • ��ϵͳ�� getrusage(2) �� man page