* 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.
This commit is contained in:
Christopher Faylor
2001-10-21 23:44:43 +00:00
parent c43c5c1643
commit 1f0191e542
3 changed files with 23 additions and 5 deletions

View File

@@ -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"