diff options
author | Christopher Faylor <me@cgf.cx> | 2001-10-21 23:44:43 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2001-10-21 23:44:43 +0000 |
commit | 1f0191e5425474567dc786c14d84a59df597855f (patch) | |
tree | 5ea17f0c7f35bcdbf416950ca04abf8fcebdf4c1 /winsup/cygwin/resource.cc | |
parent | c43c5c164383dbfd0401f77a92b648d711f529ea (diff) | |
download | cygnal-1f0191e5425474567dc786c14d84a59df597855f.tar.gz cygnal-1f0191e5425474567dc786c14d84a59df597855f.tar.bz2 cygnal-1f0191e5425474567dc786c14d84a59df597855f.zip |
* autoload.cc: Autoload GetProcessMemoryInfo.
* resource.cc (fill_rusage): Calculate ru_maxrss and ru_majflt entries.
(Bug report on this from Guido Serassio in the squid project). This requires
including psapi.h.
Diffstat (limited to 'winsup/cygwin/resource.cc')
-rw-r--r-- | winsup/cygwin/resource.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/winsup/cygwin/resource.cc b/winsup/cygwin/resource.cc index 8dd373b6f..9c949e4c0 100644 --- a/winsup/cygwin/resource.cc +++ b/winsup/cygwin/resource.cc @@ -20,6 +20,7 @@ details. */ #include "sync.h" #include "sigproc.h" #include "pinfo.h" +#include "psapi.h" /* add timeval values */ static void @@ -73,6 +74,14 @@ fill_rusage (struct rusage *r, HANDLE h) add_timeval (&r->ru_stime, &tv); totimeval (&tv, &user_time, 0, 0); add_timeval (&r->ru_utime, &tv); + + PROCESS_MEMORY_COUNTERS pmc; + + if (GetProcessMemoryInfo( h, &pmc, sizeof (pmc))) + { + r->ru_maxrss += (long) (pmc.WorkingSetSize /1024); + r->ru_majflt += pmc.PageFaultCount; + } } extern "C" |