getrusage(3)works just fine. However, it returned 0 for memory usage. A quote from the man page:
"The above struct was taken from BSD 4.3 Reno. Not all fields are meaningful under Linux. Right now (Linux 2.4, 2.6) only the fields ru_utime, ru_stime, ru_minflt, ru_majflt, and ru_nswap are maintained."
(This refers to
struct rusage, filled in by the
The question is why? At least some of memory statistics that should be returned by
getrusage()can already be obtained through
Tags: kernel linux