Sponsored Content
Full Discussion: getrusage()
Operating Systems HP-UX getrusage() Post 302122767 by limame on Thursday 21st of June 2007 09:27:47 AM
Old 06-21-2007
getrusage()

Hi,
Can someone gives me an example for the use of getrusage() under HP-UX and AIX. I am using this function to get system statistics.
Thank you
 

We Also Found This Discussion For You

1. Programming

fork-getrusage

Hello everybody! I wrote the following code: ... int main() { pid_t pid; for (int i=0;i<100;i++) { pid=fork(); if(pid==0) {execl("md5sum","myprog",NULL);exit(1)} else if(pid>0) { waitpid(pid,&status,0);getrusage(RUSAGE_CHILDREN,&usage);} The... (3 Replies)
Discussion started by: nicos
3 Replies
GETRUSAGE(3)								 1							      GETRUSAGE(3)

getrusage - Gets the current resource usages

SYNOPSIS
array getrusage ([int $who]) DESCRIPTION
This is an interface to getrusage(2). It gets data returned from the system call. PARAMETERS
o $who - If $who is 1, getrusage will be called with RUSAGE_CHILDREN. RETURN VALUES
Returns an associative array containing the data returned from the system call. All entries are accessible by using their documented field names. EXAMPLES
Example #1 getrusage(3) example <?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) ?> CHANGELOG
+--------+---------------------------------------------+ |Version | | | | | | | Description | | | | +--------+---------------------------------------------+ | 7.0.0 | | | | | | | This function is now supported on Windows. | | | | +--------+---------------------------------------------+ NOTES
Note On Windows getrusage(3) will only return the following members: o "ru_stime.tv_sec" o "ru_stime.tv_usec" o "ru_utime.tv_sec" o "ru_utime.tv_usec" o "ru_majflt" (only if $who is RUSAGE_SELF) o "ru_maxrss" (only if $who is RUSAGE_SELF) If getrusage(3) is called with $who set to 1 ( RUSAGE_CHILDREN), then resource usage for threads are collected (meaning that inter- nally the function is called with RUSAGE_THREAD). Note on BeOS 2000, only the following members are returned: o "ru_stime.tv_sec" o "ru_stime.tv_usec" o "ru_utime.tv_sec" o "ru_utime.tv_usec" SEE ALSO
Your system's man page on getrusage(2). PHP Documentation Group GETRUSAGE(3)
All times are GMT -4. The time now is 10:06 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy