* 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

@ -1,3 +1,10 @@
2001-10-22 Robert Collins <rbtcollins@hotmail.com>
* 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.
2001-10-20 Christopher Faylor <cgf@redhat.com>
* dll_init.cc (dll_list::alloc): Increase retry count to 1000.

View File

@ -381,6 +381,8 @@ LoadDLLfuncEx (RtlInitUnicodeString, 8, ntdll, 1)
LoadDLLfuncEx (RtlNtStatusToDosError, 4, ntdll, 1)
LoadDLLfuncEx (ZwQuerySystemInformation, 16, ntdll, 1)
LoadDLLfuncEx (GetProcessMemoryInfo, 12, psapi, 1)
LoadDLLfuncEx (LsaDeregisterLogonProcess, 4, secur32, 1)
LoadDLLfuncEx (LsaFreeReturnBuffer, 4, secur32, 1)
LoadDLLfuncEx (LsaLogonUser, 56, secur32, 1)

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"