summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2015-06-18 02:32:59 +0200
committerGiampaolo Rodola <g.rodola@gmail.com>2015-06-18 02:32:59 +0200
commit94955bbbdadf529742809720c9548e26a4c32ffa (patch)
tree7e59dd49408d6bb6e8afbc86f6d7b4a325c4fe47
parent2c98f3bb208e1cc96d69040363b56b1a1f1f729e (diff)
parent8a8a8fd5e0a8901bde0fedf331df8587bda59ae0 (diff)
downloadpsutil-94955bbbdadf529742809720c9548e26a4c32ffa.tar.gz
Merge branch 'master' of github.com:giampaolo/psutil
-rw-r--r--psutil/_psutil_windows.c15
-rw-r--r--psutil/arch/windows/process_info.c5
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