(PHP 4, PHP 5, PHP 7)
getrusage — 锟斤拷取锟斤拷前锟斤拷源使锟斤拷状锟斤拷
$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() 锟斤拷锟结返锟斤拷锟斤拷锟斤拷锟斤拷锟酵o拷
- "ru_stime.tv_sec"
- "ru_stime.tv_usec"
- "ru_utime.tv_sec"
- "ru_utime.tv_usec"
- "ru_majflt" (only if
who
isRUSAGE_SELF
)- "ru_maxrss" (only if
who
isRUSAGE_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 withRUSAGE_THREAD
).
Note:
锟斤拷 BeOS 2000锟斤拷锟斤拷锟结返锟斤拷锟斤拷锟斤拷锟斤拷锟酵o拷
- "ru_stime.tv_sec"
- "ru_stime.tv_usec"
- "ru_utime.tv_sec"
- "ru_utime.tv_usec"