summaryrefslogtreecommitdiff
path: root/psutil/_psutil_windows.c
diff options
context:
space:
mode:
Diffstat (limited to 'psutil/_psutil_windows.c')
-rw-r--r--psutil/_psutil_windows.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/psutil/_psutil_windows.c b/psutil/_psutil_windows.c
index 9a4c0944..b05db820 100644
--- a/psutil/_psutil_windows.c
+++ b/psutil/_psutil_windows.c
@@ -2683,6 +2683,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)
{
@@ -3180,7 +3193,7 @@ PsutilMethods[] =
"seconds since the epoch"},
{"proc_memory_info", psutil_proc_memory_info, METH_VARARGS,
"Return a tuple of process memory information"},
- {"proc_memory_info_2", psutil_proc_memory_info, METH_VARARGS,
+ {"proc_memory_info_2", psutil_proc_memory_info_2, METH_VARARGS,
"Alternate implementation"},
{"proc_cwd", psutil_proc_cwd, METH_VARARGS,
"Return process current working directory"},
@@ -3387,4 +3400,4 @@ void init_psutil_windows(void)
#if PY_MAJOR_VERSION >= 3
return module;
#endif
-} \ No newline at end of file
+}