ntdll: Implement ProcessVmCounters for Linux.
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
08ea8280d3
commit
bf7a97e5d3
|
@ -131,6 +131,34 @@ static void fill_VM_COUNTERS(VM_COUNTERS* pvmi)
|
||||||
#endif
|
#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
|
#else
|
||||||
|
|
||||||
static void fill_VM_COUNTERS(VM_COUNTERS* pvmi)
|
static void fill_VM_COUNTERS(VM_COUNTERS* pvmi)
|
||||||
|
|
|
@ -1078,11 +1078,8 @@ static void test_query_process_vm(void)
|
||||||
|
|
||||||
/* Check if we have some return values */
|
/* Check if we have some return values */
|
||||||
trace("WorkingSetSize : %ld\n", pvi.WorkingSetSize);
|
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)
|
static void test_query_process_io(void)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue