From 1f0191e5425474567dc786c14d84a59df597855f Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Sun, 21 Oct 2001 23:44:43 +0000 Subject: * 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. --- winsup/cygwin/resource.cc | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'winsup/cygwin/resource.cc') 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" -- cgit v1.2.3