diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2023-04-10 13:17:26 -0700 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2023-04-10 13:17:26 -0700 |
commit | e6bf2bcafc41319a22945e98f50906149527ff51 (patch) | |
tree | ea8a422f6a63ad3743882eff39170a8830b7ea8e /psutil/_psutil_windows.c | |
parent | 52fe5517f716dedf9c9918e56325e49a49146130 (diff) | |
download | psutil-e6bf2bcafc41319a22945e98f50906149527ff51.tar.gz |
move psutil_virtual_mem() in a new mem.c file
Diffstat (limited to 'psutil/_psutil_windows.c')
-rw-r--r-- | psutil/_psutil_windows.c | 30 |
1 files changed, 1 insertions, 29 deletions
diff --git a/psutil/_psutil_windows.c b/psutil/_psutil_windows.c index 6e51c449..969c5713 100644 --- a/psutil/_psutil_windows.c +++ b/psutil/_psutil_windows.c @@ -33,6 +33,7 @@ #include "arch/windows/process_handles.h" #include "arch/windows/disk.h" #include "arch/windows/cpu.h" +#include "arch/windows/mem.h" #include "arch/windows/net.h" #include "arch/windows/services.h" #include "arch/windows/socks.h" @@ -603,35 +604,6 @@ psutil_proc_memory_uss(PyObject *self, PyObject *args) { return Py_BuildValue("I", wsCounters.NumberOfPrivatePages); } - -/* - * Return a Python integer indicating the total amount of physical memory - * in bytes. - */ -static PyObject * -psutil_virtual_mem(PyObject *self, PyObject *args) { - unsigned long long totalPhys, availPhys, totalSys, availSys, pageSize; - PERFORMANCE_INFORMATION perfInfo; - - if (! GetPerformanceInfo(&perfInfo, sizeof(PERFORMANCE_INFORMATION))) { - PyErr_SetFromWindowsErr(0); - return NULL; - } - // values are size_t, widen (if needed) to long long - pageSize = perfInfo.PageSize; - totalPhys = perfInfo.PhysicalTotal * pageSize; - availPhys = perfInfo.PhysicalAvailable * pageSize; - totalSys = perfInfo.CommitLimit * pageSize; - availSys = totalSys - perfInfo.CommitTotal * pageSize; - return Py_BuildValue( - "(LLLL)", - totalPhys, - availPhys, - totalSys, - availSys); -} - - /* * Return process current working directory as a Python string. */ |