Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2001-10-22 03:44:43 +0400
committerChristopher Faylor <me@cgf.cx>2001-10-22 03:44:43 +0400
commit1f0191e5425474567dc786c14d84a59df597855f (patch)
tree5ea17f0c7f35bcdbf416950ca04abf8fcebdf4c1 /winsup/cygwin/resource.cc
parentc43c5c164383dbfd0401f77a92b648d711f529ea (diff)
* 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.cc9
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"