Alex Henrie : ntdll: Implement ProcessVmCounters for Linux.
Alexandre Julliard
julliard at winehq.org
Tue Mar 21 16:05:53 CDT 2017
Module: wine
Branch: master
Commit: bf7a97e5d3482d1ee4130d716f02b870df804040
URL: http://source.winehq.org/git/wine.git/?a=commit;h=bf7a97e5d3482d1ee4130d716f02b870df804040
Author: Alex Henrie <alexhenrie24 at gmail.com>
Date: Mon Mar 20 22:55:37 2017 -0600
ntdll: Implement ProcessVmCounters for Linux.
Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ntdll/process.c | 28 ++++++++++++++++++++++++++++
dlls/ntdll/tests/info.c | 5 +----
2 files changed, 29 insertions(+), 4 deletions(-)
diff --git a/dlls/ntdll/process.c b/dlls/ntdll/process.c
index 8689d9b..9522256 100644
--- a/dlls/ntdll/process.c
+++ b/dlls/ntdll/process.c
@@ -131,6 +131,34 @@ static void fill_VM_COUNTERS(VM_COUNTERS* pvmi)
#endif
}
+#elif defined(linux)
+
+static void fill_VM_COUNTERS(VM_COUNTERS* pvmi)
+{
+ FILE *f;
+ char line[256];
+ unsigned long value;
+
+ f = fopen("/proc/self/status", "r");
+ if (!f) return;
+
+ while (fgets(line, sizeof(line), f))
+ {
+ if (sscanf(line, "VmPeak: %lu", &value))
+ pvmi->PeakVirtualSize = (ULONG64)value * 1024;
+ else if (sscanf(line, "VmSize: %lu", &value))
+ pvmi->VirtualSize = (ULONG64)value * 1024;
+ else if (sscanf(line, "VmHWM: %lu", &value))
+ pvmi->PeakWorkingSetSize = (ULONG64)value * 1024;
+ else if (sscanf(line, "VmRSS: %lu", &value))
+ pvmi->WorkingSetSize = (ULONG64)value * 1024;
+ else if (sscanf(line, "VmSwap: %lu", &value))
+ pvmi->PeakPagefileUsage = pvmi->PagefileUsage = (ULONG64)value * 1024;
+ }
+
+ fclose(f);
+}
+
#else
static void fill_VM_COUNTERS(VM_COUNTERS* pvmi)
diff --git a/dlls/ntdll/tests/info.c b/dlls/ntdll/tests/info.c
index 448bc64..35e25af 100644
--- a/dlls/ntdll/tests/info.c
+++ b/dlls/ntdll/tests/info.c
@@ -1078,10 +1078,7 @@ static void test_query_process_vm(void)
/* Check if we have some return values */
trace("WorkingSetSize : %ld\n", pvi.WorkingSetSize);
- todo_wine
- {
- ok( pvi.WorkingSetSize > 0, "Expected a WorkingSetSize > 0\n");
- }
+ ok( pvi.WorkingSetSize > 0, "Expected a WorkingSetSize > 0\n");
}
static void test_query_process_io(void)
More information about the wine-cvs
mailing list