diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2023-04-10 13:20:39 -0700 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2023-04-10 13:20:39 -0700 |
commit | 4dd1e215f3d49fb3a5074b82430bf6199c14898e (patch) | |
tree | 63d01d6e759a571133600c8e7886abf5bbea6219 | |
parent | e6bf2bcafc41319a22945e98f50906149527ff51 (diff) | |
download | psutil-4dd1e215f3d49fb3a5074b82430bf6199c14898e.tar.gz |
move psutil_getpagesize() in a new mem.c file
-rw-r--r-- | psutil/_psutil_windows.c | 11 | ||||
-rw-r--r-- | psutil/arch/windows/mem.c | 8 | ||||
-rw-r--r-- | psutil/arch/windows/mem.h | 3 |
3 files changed, 10 insertions, 12 deletions
diff --git a/psutil/_psutil_windows.c b/psutil/_psutil_windows.c index 969c5713..2ed937ee 100644 --- a/psutil/_psutil_windows.c +++ b/psutil/_psutil_windows.c @@ -1515,17 +1515,6 @@ psutil_sensors_battery(PyObject *self, PyObject *args) { } -/* - * System memory page size as an int. - */ -static PyObject * -psutil_getpagesize(PyObject *self, PyObject *args) { - // XXX: we may want to use GetNativeSystemInfo to differentiate - // page size for WoW64 processes (but am not sure). - return Py_BuildValue("I", PSUTIL_SYSTEM_INFO.dwPageSize); -} - - // ------------------------ Python init --------------------------- static PyMethodDef diff --git a/psutil/arch/windows/mem.c b/psutil/arch/windows/mem.c index 8b678254..18b535e6 100644 --- a/psutil/arch/windows/mem.c +++ b/psutil/arch/windows/mem.c @@ -12,6 +12,14 @@ PyObject * +psutil_getpagesize(PyObject *self, PyObject *args) { + // XXX: we may want to use GetNativeSystemInfo to differentiate + // page size for WoW64 processes (but am not sure). + return Py_BuildValue("I", PSUTIL_SYSTEM_INFO.dwPageSize); +} + + +PyObject * psutil_virtual_mem(PyObject *self, PyObject *args) { unsigned long long totalPhys, availPhys, totalSys, availSys, pageSize; PERFORMANCE_INFORMATION perfInfo; diff --git a/psutil/arch/windows/mem.h b/psutil/arch/windows/mem.h index 871cd64e..a10781df 100644 --- a/psutil/arch/windows/mem.h +++ b/psutil/arch/windows/mem.h @@ -6,4 +6,5 @@ #include <Python.h> -PyObject *psutil_virtual_mem(PyObject* self, PyObject* args); +PyObject *psutil_getpagesize(PyObject *self, PyObject *args); +PyObject *psutil_virtual_mem(PyObject *self, PyObject *args); |