diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2015-06-17 05:31:46 -0700 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2015-06-17 05:31:46 -0700 |
commit | 8a8a8fd5e0a8901bde0fedf331df8587bda59ae0 (patch) | |
tree | e7310ec8f8542eae591e017677b4c0509c757d21 | |
parent | 17325efdd1b500870f58e794b7c2e02bf3516c78 (diff) | |
download | psutil-8a8a8fd5e0a8901bde0fedf331df8587bda59ae0.tar.gz |
windows: add some C comments
-rw-r--r-- | psutil/_psutil_windows.c | 15 | ||||
-rw-r--r-- | psutil/arch/windows/process_info.c | 5 |
2 files changed, 18 insertions, 2 deletions
diff --git a/psutil/_psutil_windows.c b/psutil/_psutil_windows.c index 670be24c..7e6792db 100644 --- a/psutil/_psutil_windows.c +++ b/psutil/_psutil_windows.c @@ -2691,6 +2691,19 @@ psutil_proc_num_handles(PyObject *self, PyObject *args) } +/* + * Get various process information by using NtQuerySystemInformation. + * We use this as a fallback when faster functions fail with access + * denied. This is slower because it iterates over all processes. + * Returned tuple includes the following process info: + * + * - num_threads + * - ctx_switches + * - num_handles (fallback) + * - user/kernel times (fallback) + * - create time (fallback) + * - io counters (fallback) + */ static PyObject * psutil_proc_info(PyObject *self, PyObject *args) { @@ -3395,4 +3408,4 @@ void init_psutil_windows(void) #if PY_MAJOR_VERSION >= 3 return module; #endif -}
\ No newline at end of file +} diff --git a/psutil/arch/windows/process_info.c b/psutil/arch/windows/process_info.c index ad272bff..a59cce47 100644 --- a/psutil/arch/windows/process_info.c +++ b/psutil/arch/windows/process_info.c @@ -357,7 +357,10 @@ const int STATUS_BUFFER_TOO_SMALL = 0xC0000023L; /* * Given a process PID and a PSYSTEM_PROCESS_INFORMATION structure - * fills the structure with process information. + * fills the structure with various process information by using + * NtQuerySystemInformation. + * We use this as a fallback when faster functions fail with access + * denied. This is slower because it iterates over all processes. * On success return 1, else 0 with Python exception already set. */ int |