getrusagefunction is used to retrieve important information from a given process or its threads. This will not provide all the information available, but will report on information such as context switches and page faults.
getrusage()function is used to retrieve important information from a given process or its threads, which would otherwise need to be cataloged from several different files in the
/proc/directory and would be hard to synchronize with specific actions or events on the application. Information such as the amount of voluntary and involuntary context switches, major and minor page faults, amount of memory in use and a few other pieces of information can be obtained with the
getrusage()results are set by the kernel. Some of them are kept for compatibility reasons only.