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:
authorCorinna Vinschen <corinna@vinschen.de>2011-05-11 13:07:20 +0400
committerCorinna Vinschen <corinna@vinschen.de>2011-05-11 13:07:20 +0400
commit34a6eeabfffd0ba2f1db43bae5f7239a49e080bb (patch)
tree9a02033c02e292c6f62724143d4ecd0014c2e72d /winsup/cygwin/resource.cc
parent933d2af50db22d4b79eb5f9849df11d3956cac6c (diff)
* autoload.cc (GetProcessMemoryInfo): Remove.
* resource.cc (fill_rusage): Call NtQueryInformationProcess rather than GetProcessMemoryInfo to drop a psapi dependency.
Diffstat (limited to 'winsup/cygwin/resource.cc')
-rw-r--r--winsup/cygwin/resource.cc15
1 files changed, 8 insertions, 7 deletions
diff --git a/winsup/cygwin/resource.cc b/winsup/cygwin/resource.cc
index fed61e8ee..43feec02b 100644
--- a/winsup/cygwin/resource.cc
+++ b/winsup/cygwin/resource.cc
@@ -1,6 +1,6 @@
/* resource.cc: getrusage () and friends.
- Copyright 1996, 1997, 1998, 2000, 2001, 2002, 2009, 2010 Red Hat, Inc.
+ Copyright 1996, 1997, 1998, 2000, 2001, 2002, 2009, 2010, 2011 Red Hat, Inc.
Written by Steve Chamberlain (sac@cygnus.com), Doug Evans (dje@cygnus.com),
Geoffrey Noer (noer@cygnus.com) of Cygnus Support.
@@ -22,6 +22,7 @@ details. */
#include "pinfo.h"
#include "dtable.h"
#include "cygheap.h"
+#include "ntdll.h"
/* add timeval values */
static void
@@ -76,13 +77,13 @@ fill_rusage (struct rusage *r, HANDLE h)
totimeval (&tv, &user_time, 0, 0);
add_timeval (&r->ru_utime, &tv);
- PROCESS_MEMORY_COUNTERS pmc;
-
- memset (&pmc, 0, sizeof (pmc));
- if (GetProcessMemoryInfo (h, &pmc, sizeof (pmc)))
+ VM_COUNTERS vmc;
+ NTSTATUS status = NtQueryInformationProcess (h, ProcessVmCounters, &vmc,
+ sizeof vmc, NULL);
+ if (NT_SUCCESS (status))
{
- r->ru_maxrss += (long) (pmc.WorkingSetSize /1024);
- r->ru_majflt += pmc.PageFaultCount;
+ r->ru_maxrss += (long) (vmc.WorkingSetSize / 1024);
+ r->ru_majflt += vmc.PageFaultCount;
}
}