summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2022-01-16 21:44:55 +0100
committerGiampaolo Rodola <g.rodola@gmail.com>2022-01-16 21:44:55 +0100
commit6032eb9b53f80dddb6bceb86dab15b21ac570e80 (patch)
tree612f1e5ffe6077e3e9ee25189773ace5778104e4
parent0458fc016a19516971a0af6b6e734821c6a3d5bc (diff)
parente5a19dec0cc78bb8a89f1e0a1baeeb91a54578ef (diff)
downloadpsutil-6032eb9b53f80dddb6bceb86dab15b21ac570e80.tar.gz
merge from master
Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
-rw-r--r--psutil/_psutil_aix.c63
-rw-r--r--psutil/_psutil_bsd.c109
-rw-r--r--psutil/_psutil_linux.c34
-rw-r--r--psutil/_psutil_osx.c105
-rw-r--r--psutil/_psutil_posix.c21
-rw-r--r--psutil/_psutil_sunos.c63
-rw-r--r--psutil/_psutil_windows.c172
7 files changed, 187 insertions, 380 deletions
diff --git a/psutil/_psutil_aix.c b/psutil/_psutil_aix.c
index ba638641..f5c5cc66 100644
--- a/psutil/_psutil_aix.c
+++ b/psutil/_psutil_aix.c
@@ -989,58 +989,37 @@ static PyMethodDef
PsutilMethods[] =
{
// --- process-related functions
- {"proc_basic_info", psutil_proc_basic_info, METH_VARARGS,
- "Return process ppid, rss, vms, ctime, nice, nthreads, status and tty"},
- {"proc_name", psutil_proc_name, METH_VARARGS,
- "Return process name."},
- {"proc_args", psutil_proc_args, METH_VARARGS,
- "Return process command line arguments."},
- {"proc_environ", psutil_proc_environ, METH_VARARGS,
- "Return process environment variables."},
- {"proc_cpu_times", psutil_proc_cpu_times, METH_VARARGS,
- "Return process user and system CPU times."},
- {"proc_cred", psutil_proc_cred, METH_VARARGS,
- "Return process uids/gids."},
+ {"proc_args", psutil_proc_args, METH_VARARGS},
+ {"proc_basic_info", psutil_proc_basic_info, METH_VARARGS},
+ {"proc_cpu_times", psutil_proc_cpu_times, METH_VARARGS},
+ {"proc_cred", psutil_proc_cred, METH_VARARGS},
+ {"proc_environ", psutil_proc_environ, METH_VARARGS},
+ {"proc_name", psutil_proc_name, METH_VARARGS},
#ifdef CURR_VERSION_THREAD
- {"proc_threads", psutil_proc_threads, METH_VARARGS,
- "Return process threads"},
+ {"proc_threads", psutil_proc_threads, METH_VARARGS},
#endif
#ifdef CURR_VERSION_PROCESS
- {"proc_io_counters", psutil_proc_io_counters, METH_VARARGS,
- "Get process I/O counters."},
+ {"proc_io_counters", psutil_proc_io_counters, METH_VARARGS},
#endif
- {"proc_num_ctx_switches", psutil_proc_num_ctx_switches, METH_VARARGS,
- "Get process I/O counters."},
+ {"proc_num_ctx_switches", psutil_proc_num_ctx_switches, METH_VARARGS},
// --- system-related functions
- {"users", psutil_users, METH_VARARGS,
- "Return currently connected users."},
- {"disk_partitions", psutil_disk_partitions, METH_VARARGS,
- "Return disk partitions."},
- {"boot_time", psutil_boot_time, METH_VARARGS,
- "Return system boot time in seconds since the EPOCH."},
- {"per_cpu_times", psutil_per_cpu_times, METH_VARARGS,
- "Return system per-cpu times as a list of tuples"},
- {"disk_io_counters", psutil_disk_io_counters, METH_VARARGS,
- "Return a Python dict of tuples for disk I/O statistics."},
- {"virtual_mem", psutil_virtual_mem, METH_VARARGS,
- "Return system virtual memory usage statistics"},
- {"swap_mem", psutil_swap_mem, METH_VARARGS,
- "Return stats about swap memory, in bytes"},
+ {"boot_time", psutil_boot_time, METH_VARARGS},
+ {"disk_io_counters", psutil_disk_io_counters, METH_VARARGS},
+ {"disk_partitions", psutil_disk_partitions, METH_VARARGS},
+ {"per_cpu_times", psutil_per_cpu_times, METH_VARARGS},
+ {"swap_mem", psutil_swap_mem, METH_VARARGS},
+ {"users", psutil_users, METH_VARARGS},
+ {"virtual_mem", psutil_virtual_mem, METH_VARARGS},
#if defined(CURR_VERSION_NETINTERFACE) && CURR_VERSION_NETINTERFACE >= 3
- {"net_io_counters", psutil_net_io_counters, METH_VARARGS,
- "Return a Python dict of tuples for network I/O statistics."},
+ {"net_io_counters", psutil_net_io_counters, METH_VARARGS},
#endif
- {"net_connections", psutil_net_connections, METH_VARARGS,
- "Return system-wide connections"},
- {"net_if_stats", psutil_net_if_stats, METH_VARARGS,
- "Return NIC stats (isup, mtu)"},
- {"cpu_stats", psutil_cpu_stats, METH_VARARGS,
- "Return CPU statistics"},
+ {"cpu_stats", psutil_cpu_stats, METH_VARARGS},
+ {"net_connections", psutil_net_connections, METH_VARARGS},
+ {"net_if_stats", psutil_net_if_stats, METH_VARARGS},
// --- others
- {"set_debug", psutil_set_debug, METH_VARARGS,
- "Enable or disable PSUTIL_DEBUG messages"},
+ {"set_debug", psutil_set_debug, METH_VARARGS},
{NULL, NULL, 0, NULL}
};
diff --git a/psutil/_psutil_bsd.c b/psutil/_psutil_bsd.c
index 23af4344..a1aec439 100644
--- a/psutil/_psutil_bsd.c
+++ b/psutil/_psutil_bsd.c
@@ -1063,92 +1063,54 @@ error:
static PyMethodDef mod_methods[] = {
// --- per-process functions
- {"proc_oneshot_info", psutil_proc_oneshot_info, METH_VARARGS,
- "Return multiple info about a process"},
- {"proc_name", psutil_proc_name, METH_VARARGS,
- "Return process name"},
- {"proc_cmdline", psutil_proc_cmdline, METH_VARARGS,
- "Return process cmdline as a list of cmdline arguments"},
- {"proc_threads", psutil_proc_threads, METH_VARARGS,
- "Return process threads"},
+ {"proc_cmdline", psutil_proc_cmdline, METH_VARARGS},
+ {"proc_name", psutil_proc_name, METH_VARARGS},
+ {"proc_oneshot_info", psutil_proc_oneshot_info, METH_VARARGS},
+ {"proc_threads", psutil_proc_threads, METH_VARARGS},
#if defined(PSUTIL_FREEBSD) || defined(PSUTIL_OPENBSD)
- {"proc_connections", psutil_proc_connections, METH_VARARGS,
- "Return connections opened by process"},
+ {"proc_connections", psutil_proc_connections, METH_VARARGS},
#endif
- {"proc_cwd", psutil_proc_cwd, METH_VARARGS,
- "Return process current working directory."},
+ {"proc_cwd", psutil_proc_cwd, METH_VARARGS},
#if defined(__FreeBSD_version) && __FreeBSD_version >= 800000 || PSUTIL_OPENBSD || defined(PSUTIL_NETBSD)
- {"proc_num_fds", psutil_proc_num_fds, METH_VARARGS,
- "Return the number of file descriptors opened by this process"},
- {"proc_open_files", psutil_proc_open_files, METH_VARARGS,
- "Return files opened by process as a list of (path, fd) tuples"},
+ {"proc_num_fds", psutil_proc_num_fds, METH_VARARGS},
+ {"proc_open_files", psutil_proc_open_files, METH_VARARGS},
#endif
#if defined(PSUTIL_FREEBSD) || defined(PSUTIL_NETBSD)
- {"proc_num_threads", psutil_proc_num_threads, METH_VARARGS,
- "Return number of threads used by process"},
+ {"proc_num_threads", psutil_proc_num_threads, METH_VARARGS},
#endif
#if defined(PSUTIL_FREEBSD)
- {"proc_exe", psutil_proc_exe, METH_VARARGS,
- "Return process pathname executable"},
- {"proc_memory_maps", psutil_proc_memory_maps, METH_VARARGS,
- "Return a list of tuples for every process's memory map"},
- {"proc_cpu_affinity_get", psutil_proc_cpu_affinity_get, METH_VARARGS,
- "Return process CPU affinity."},
- {"proc_cpu_affinity_set", psutil_proc_cpu_affinity_set, METH_VARARGS,
- "Set process CPU affinity."},
- {"proc_getrlimit", psutil_proc_getrlimit, METH_VARARGS,
- "Get process resource limits."},
- {"proc_setrlimit", psutil_proc_setrlimit, METH_VARARGS,
- "Set process resource limits."},
+ {"cpu_topology", psutil_cpu_topology, METH_VARARGS},
+ {"proc_cpu_affinity_get", psutil_proc_cpu_affinity_get, METH_VARARGS},
+ {"proc_cpu_affinity_set", psutil_proc_cpu_affinity_set, METH_VARARGS},
+ {"proc_exe", psutil_proc_exe, METH_VARARGS},
+ {"proc_getrlimit", psutil_proc_getrlimit, METH_VARARGS},
+ {"proc_memory_maps", psutil_proc_memory_maps, METH_VARARGS},
+ {"proc_setrlimit", psutil_proc_setrlimit, METH_VARARGS},
#endif
- {"proc_environ", psutil_proc_environ, METH_VARARGS,
- "Return process environment"},
+ {"proc_environ", psutil_proc_environ, METH_VARARGS},
// --- system-related functions
-
- {"pids", psutil_pids, METH_VARARGS,
- "Returns a list of PIDs currently running on the system"},
- {"cpu_count_logical", psutil_cpu_count_logical, METH_VARARGS,
- "Return number of logical CPUs on the system"},
- {"virtual_mem", psutil_virtual_mem, METH_VARARGS,
- "Return system virtual memory usage statistics"},
- {"swap_mem", psutil_swap_mem, METH_VARARGS,
- "Return swap mem stats"},
- {"cpu_times", psutil_cpu_times, METH_VARARGS,
- "Return system cpu times as a tuple (user, system, nice, idle, irc)"},
- {"per_cpu_times", psutil_per_cpu_times, METH_VARARGS,
- "Return system per-cpu times as a list of tuples"},
- {"boot_time", psutil_boot_time, METH_VARARGS,
- "Return the system boot time expressed in seconds since the epoch."},
- {"disk_partitions", psutil_disk_partitions, METH_VARARGS,
- "Return a list of tuples including device, mount point and "
- "fs type for all partitions mounted on the system."},
- {"net_io_counters", psutil_net_io_counters, METH_VARARGS,
- "Return dict of tuples of networks I/O information."},
- {"disk_io_counters", psutil_disk_io_counters, METH_VARARGS,
- "Return a Python dict of tuples for disk I/O information"},
- {"users", psutil_users, METH_VARARGS,
- "Return currently connected users as a list of tuples"},
- {"cpu_stats", psutil_cpu_stats, METH_VARARGS,
- "Return CPU statistics"},
+ {"boot_time", psutil_boot_time, METH_VARARGS},
+ {"cpu_count_logical", psutil_cpu_count_logical, METH_VARARGS},
+ {"cpu_stats", psutil_cpu_stats, METH_VARARGS},
+ {"cpu_times", psutil_cpu_times, METH_VARARGS},
+ {"disk_io_counters", psutil_disk_io_counters, METH_VARARGS},
+ {"disk_partitions", psutil_disk_partitions, METH_VARARGS},
+ {"net_io_counters", psutil_net_io_counters, METH_VARARGS},
+ {"per_cpu_times", psutil_per_cpu_times, METH_VARARGS},
+ {"pids", psutil_pids, METH_VARARGS},
+ {"swap_mem", psutil_swap_mem, METH_VARARGS},
+ {"users", psutil_users, METH_VARARGS},
+ {"virtual_mem", psutil_virtual_mem, METH_VARARGS},
#if defined(PSUTIL_FREEBSD) || defined(PSUTIL_OPENBSD)
- {"cpu_freq", psutil_cpu_freq, METH_VARARGS,
- "Return CPU frequency"},
+ {"cpu_freq", psutil_cpu_freq, METH_VARARGS},
#endif
#if defined(PSUTIL_FREEBSD) || defined(PSUTIL_NETBSD)
- {"net_connections", psutil_net_connections, METH_VARARGS,
- "Return system-wide open connections."},
+ {"net_connections", psutil_net_connections, METH_VARARGS},
#endif
#if defined(PSUTIL_FREEBSD)
- {"sensors_battery", psutil_sensors_battery, METH_VARARGS,
- "Return battery information."},
- {"sensors_cpu_temperature", psutil_sensors_cpu_temperature, METH_VARARGS,
- "Return temperature information for a given CPU core number."},
- {"cpu_frequency", psutil_cpu_freq, METH_VARARGS,
- "Return frequency of a given CPU"},
- {"cpu_topology", psutil_cpu_topology, METH_VARARGS,
- "Return CPU topology as an XML string."},
- {"cpu_model", psutil_cpu_model, METH_VARARGS, ""},
+ {"sensors_battery", psutil_sensors_battery, METH_VARARGS},
+ {"sensors_cpu_temperature", psutil_sensors_cpu_temperature, METH_VARARGS},
#endif
#if defined(PSUTIL_NETBSD)
{"cpu_model", psutil_cpu_model, METH_VARARGS, ""},
@@ -1157,14 +1119,13 @@ static PyMethodDef mod_methods[] = {
{"cpu_vendor", psutil_cpu_vendor, METH_VARARGS, ""},
{"cpu_model", psutil_cpu_model, METH_VARARGS, ""},
#endif
-
// --- others
- {"set_debug", psutil_set_debug, METH_VARARGS,
- "Enable or disable PSUTIL_DEBUG messages"},
+ {"set_debug", psutil_set_debug, METH_VARARGS},
{NULL, NULL, 0, NULL}
};
+
#if PY_MAJOR_VERSION >= 3
#define INITERR return NULL
diff --git a/psutil/_psutil_linux.c b/psutil/_psutil_linux.c
index a38a5090..f4ba6808 100644
--- a/psutil/_psutil_linux.c
+++ b/psutil/_psutil_linux.c
@@ -502,37 +502,23 @@ static PyMethodDef mod_methods[] = {
// --- per-process functions
#if PSUTIL_HAVE_IOPRIO
- {"proc_ioprio_get", psutil_proc_ioprio_get, METH_VARARGS,
- "Get process I/O priority"},
- {"proc_ioprio_set", psutil_proc_ioprio_set, METH_VARARGS,
- "Set process I/O priority"},
+ {"proc_ioprio_get", psutil_proc_ioprio_get, METH_VARARGS},
+ {"proc_ioprio_set", psutil_proc_ioprio_set, METH_VARARGS},
#endif
#ifdef PSUTIL_HAVE_CPU_AFFINITY
- {"proc_cpu_affinity_get", psutil_proc_cpu_affinity_get, METH_VARARGS,
- "Return process CPU affinity as a Python long (the bitmask)."},
- {"proc_cpu_affinity_set", psutil_proc_cpu_affinity_set, METH_VARARGS,
- "Set process CPU affinity; expects a bitmask."},
+ {"proc_cpu_affinity_get", psutil_proc_cpu_affinity_get, METH_VARARGS},
+ {"proc_cpu_affinity_set", psutil_proc_cpu_affinity_set, METH_VARARGS},
#endif
-
// --- system related functions
-
- {"disk_partitions", psutil_disk_partitions, METH_VARARGS,
- "Return disk mounted partitions as a list of tuples including "
- "device, mount point and filesystem type"},
- {"users", psutil_users, METH_VARARGS,
- "Return currently connected users as a list of tuples"},
- {"net_if_duplex_speed", psutil_net_if_duplex_speed, METH_VARARGS,
- "Return duplex and speed info about a NIC"},
- {"cpu_caches", psutil_cpu_caches, METH_VARARGS,
- "Return L1/2/3 CPU caches"},
+ {"disk_partitions", psutil_disk_partitions, METH_VARARGS},
+ {"users", psutil_users, METH_VARARGS},
+ {"net_if_duplex_speed", psutil_net_if_duplex_speed, METH_VARARGS},
+ {"cpu_caches", psutil_cpu_caches, METH_VARARGS},
// --- linux specific
-
- {"linux_sysinfo", psutil_linux_sysinfo, METH_VARARGS,
- "A wrapper around sysinfo(), return system memory usage statistics"},
+ {"linux_sysinfo", psutil_linux_sysinfo, METH_VARARGS},
// --- others
- {"set_debug", psutil_set_debug, METH_VARARGS,
- "Enable or disable PSUTIL_DEBUG messages"},
+ {"set_debug", psutil_set_debug, METH_VARARGS},
{NULL, NULL, 0, NULL}
};
diff --git a/psutil/_psutil_osx.c b/psutil/_psutil_osx.c
index d28bc2f7..5e74cadd 100644
--- a/psutil/_psutil_osx.c
+++ b/psutil/_psutil_osx.c
@@ -1644,80 +1644,45 @@ error:
*/
static PyMethodDef mod_methods[] = {
// --- per-process functions
-
- {"proc_kinfo_oneshot", psutil_proc_kinfo_oneshot, METH_VARARGS,
- "Return multiple process info."},
- {"proc_pidtaskinfo_oneshot", psutil_proc_pidtaskinfo_oneshot, METH_VARARGS,
- "Return multiple process info."},
- {"proc_name", psutil_proc_name, METH_VARARGS,
- "Return process name"},
- {"proc_cmdline", psutil_proc_cmdline, METH_VARARGS,
- "Return process cmdline as a list of cmdline arguments"},
- {"proc_environ", psutil_proc_environ, METH_VARARGS,
- "Return process environment data"},
- {"proc_exe", psutil_proc_exe, METH_VARARGS,
- "Return path of the process executable"},
- {"proc_cwd", psutil_proc_cwd, METH_VARARGS,
- "Return process current working directory."},
- {"proc_memory_uss", psutil_proc_memory_uss, METH_VARARGS,
- "Return process USS memory"},
- {"proc_threads", psutil_proc_threads, METH_VARARGS,
- "Return process threads as a list of tuples"},
- {"proc_open_files", psutil_proc_open_files, METH_VARARGS,
- "Return files opened by process as a list of tuples"},
- {"proc_num_fds", psutil_proc_num_fds, METH_VARARGS,
- "Return the number of fds opened by process."},
- {"proc_connections", psutil_proc_connections, METH_VARARGS,
- "Get process TCP and UDP connections as a list of tuples"},
+ {"proc_cmdline", psutil_proc_cmdline, METH_VARARGS},
+ {"proc_connections", psutil_proc_connections, METH_VARARGS},
+ {"proc_cwd", psutil_proc_cwd, METH_VARARGS},
+ {"proc_environ", psutil_proc_environ, METH_VARARGS},
+ {"proc_exe", psutil_proc_exe, METH_VARARGS},
+ {"proc_kinfo_oneshot", psutil_proc_kinfo_oneshot, METH_VARARGS},
+ {"proc_memory_uss", psutil_proc_memory_uss, METH_VARARGS},
+ {"proc_name", psutil_proc_name, METH_VARARGS},
+ {"proc_num_fds", psutil_proc_num_fds, METH_VARARGS},
+ {"proc_open_files", psutil_proc_open_files, METH_VARARGS},
+ {"proc_pidtaskinfo_oneshot", psutil_proc_pidtaskinfo_oneshot, METH_VARARGS},
+ {"proc_threads", psutil_proc_threads, METH_VARARGS},
// --- system-related functions
-
- {"pids", psutil_pids, METH_VARARGS,
- "Returns a list of PIDs currently running on the system"},
- {"virtual_mem", psutil_virtual_mem, METH_VARARGS,
- "Return system virtual memory stats"},
- {"swap_mem", psutil_swap_mem, METH_VARARGS,
- "Return stats about swap memory, in bytes"},
- {"boot_time", psutil_boot_time, METH_VARARGS,
- "Return the system boot time expressed in seconds since the epoch."},
- {"disk_partitions", psutil_disk_partitions, METH_VARARGS,
- "Return a list of tuples including device, mount point and "
- "fs type for all partitions mounted on the system."},
- {"net_io_counters", psutil_net_io_counters, METH_VARARGS,
- "Return dict of tuples of networks I/O information."},
- {"disk_io_counters", psutil_disk_io_counters, METH_VARARGS,
- "Return dict of tuples of disks I/O information."},
- {"users", psutil_users, METH_VARARGS,
- "Return currently connected users as a list of tuples"},
- {"sensors_battery", psutil_sensors_battery, METH_VARARGS,
- "Return battery information."},
-
- // system CPU
- {"cpu_count_logical", psutil_cpu_count_logical, METH_VARARGS,
- "Return number of logical CPUs on the system"},
- {"cpu_count_cores", psutil_cpu_count_cores, METH_VARARGS,
- "Return number of CPU cores on the system"},
- {"cpu_count_sockets", psutil_cpu_count_cores, METH_VARARGS,
- "Return number of physical CPU sockets on the motherboard"},
- {"cpu_times", psutil_cpu_times, METH_VARARGS,
- "Return system cpu times as a tuple (user, system, nice, idle, irc)"},
- {"per_cpu_times", psutil_per_cpu_times, METH_VARARGS,
- "Return system per-cpu times as a list of tuples"},
- {"cpu_freq", psutil_cpu_freq, METH_VARARGS,
- "Return cpu current frequency"},
- {"cpu_stats", psutil_cpu_stats, METH_VARARGS,
- "Return CPU statistics"},
- {"cpu_model", psutil_cpu_model, METH_VARARGS, ""},
- {"cpu_vendor", psutil_cpu_vendor, METH_VARARGS, ""},
- {"cpu_flags", psutil_cpu_flags, METH_VARARGS, ""},
- {"cpu_l1i_cache", psutil_cpu_l1i_cache, METH_VARARGS, ""},
- {"cpu_l1d_cache", psutil_cpu_l1d_cache, METH_VARARGS, ""},
- {"cpu_l2_cache", psutil_cpu_l2_cache, METH_VARARGS, ""},
- {"cpu_l3_cache", psutil_cpu_l3_cache, METH_VARARGS, ""},
+ {"boot_time", psutil_boot_time, METH_VARARGS},
+ {"cpu_count_cores", psutil_cpu_count_cores, METH_VARARGS},
+ {"cpu_count_logical", psutil_cpu_count_logical, METH_VARARGS},
+ {"cpu_flags", psutil_cpu_flags, METH_VARARGS},
+ {"cpu_freq", psutil_cpu_freq, METH_VARARGS},
+ {"cpu_l1d_cache", psutil_cpu_l1d_cache, METH_VARARGS},
+ {"cpu_l1i_cache", psutil_cpu_l1i_cache, METH_VARARGS},
+ {"cpu_l2_cache", psutil_cpu_l2_cache, METH_VARARGS},
+ {"cpu_l3_cache", psutil_cpu_l3_cache, METH_VARARGS},
+ {"cpu_model", psutil_cpu_model, METH_VARARGS},
+ {"cpu_stats", psutil_cpu_stats, METH_VARARGS},
+ {"cpu_times", psutil_cpu_times, METH_VARARGS},
+ {"cpu_vendor", psutil_cpu_vendor, METH_VARARGS},
+ {"disk_io_counters", psutil_disk_io_counters, METH_VARARGS},
+ {"disk_partitions", psutil_disk_partitions, METH_VARARGS},
+ {"net_io_counters", psutil_net_io_counters, METH_VARARGS},
+ {"per_cpu_times", psutil_per_cpu_times, METH_VARARGS},
+ {"pids", psutil_pids, METH_VARARGS},
+ {"sensors_battery", psutil_sensors_battery, METH_VARARGS},
+ {"swap_mem", psutil_swap_mem, METH_VARARGS},
+ {"users", psutil_users, METH_VARARGS},
+ {"virtual_mem", psutil_virtual_mem, METH_VARARGS},
// --- others
- {"set_debug", psutil_set_debug, METH_VARARGS,
- "Enable or disable PSUTIL_DEBUG messages"},
+ {"set_debug", psutil_set_debug, METH_VARARGS},
{NULL, NULL, 0, NULL}
};
diff --git a/psutil/_psutil_posix.c b/psutil/_psutil_posix.c
index 7c0d548c..04536614 100644
--- a/psutil/_psutil_posix.c
+++ b/psutil/_psutil_posix.c
@@ -664,21 +664,14 @@ extern "C" {
* define the psutil C module methods and initialize the module.
*/
static PyMethodDef mod_methods[] = {
- {"getpriority", psutil_posix_getpriority, METH_VARARGS,
- "Return process priority"},
- {"setpriority", psutil_posix_setpriority, METH_VARARGS,
- "Set process priority"},
- {"net_if_addrs", psutil_net_if_addrs, METH_VARARGS,
- "Retrieve NICs information"},
- {"net_if_mtu", psutil_net_if_mtu, METH_VARARGS,
- "Retrieve NIC MTU"},
- {"net_if_is_running", psutil_net_if_is_running, METH_VARARGS,
- "Return True if the NIC is running."},
- {"getpagesize", psutil_getpagesize_pywrapper, METH_VARARGS,
- "Return memory page size."},
+ {"getpagesize", psutil_getpagesize_pywrapper, METH_VARARGS},
+ {"getpriority", psutil_posix_getpriority, METH_VARARGS},
+ {"net_if_addrs", psutil_net_if_addrs, METH_VARARGS},
+ {"net_if_is_running", psutil_net_if_is_running, METH_VARARGS},
+ {"net_if_mtu", psutil_net_if_mtu, METH_VARARGS},
+ {"setpriority", psutil_posix_setpriority, METH_VARARGS},
#if defined(PSUTIL_BSD) || defined(PSUTIL_OSX)
- {"net_if_duplex_speed", psutil_net_if_duplex_speed, METH_VARARGS,
- "Return NIC stats."},
+ {"net_if_duplex_speed", psutil_net_if_duplex_speed, METH_VARARGS},
#endif
{NULL, NULL, 0, NULL}
};
diff --git a/psutil/_psutil_sunos.c b/psutil/_psutil_sunos.c
index 2e0bd943..42a1ffe8 100644
--- a/psutil/_psutil_sunos.c
+++ b/psutil/_psutil_sunos.c
@@ -1635,52 +1635,31 @@ error:
static PyMethodDef
PsutilMethods[] = {
// --- process-related functions
- {"proc_basic_info", psutil_proc_basic_info, METH_VARARGS,
- "Return process ppid, rss, vms, ctime, nice, nthreads, status and tty"},
- {"proc_name_and_args", psutil_proc_name_and_args, METH_VARARGS,
- "Return process name and args."},
- {"proc_environ", psutil_proc_environ, METH_VARARGS,
- "Return process environment."},
- {"proc_cpu_times", psutil_proc_cpu_times, METH_VARARGS,
- "Return process user and system CPU times."},
- {"proc_cred", psutil_proc_cred, METH_VARARGS,
- "Return process uids/gids."},
- {"query_process_thread", psutil_proc_query_thread, METH_VARARGS,
- "Return info about a process thread"},
- {"proc_memory_maps", psutil_proc_memory_maps, METH_VARARGS,
- "Return process memory mappings"},
- {"proc_num_ctx_switches", psutil_proc_num_ctx_switches, METH_VARARGS,
- "Return the number of context switches performed by process"},
- {"proc_cpu_num", psutil_proc_cpu_num, METH_VARARGS,
- "Return what CPU the process is on"},
+ {"proc_basic_info", psutil_proc_basic_info, METH_VARARGS},
+ {"proc_cpu_num", psutil_proc_cpu_num, METH_VARARGS},
+ {"proc_cpu_times", psutil_proc_cpu_times, METH_VARARGS},
+ {"proc_cred", psutil_proc_cred, METH_VARARGS},
+ {"proc_environ", psutil_proc_environ, METH_VARARGS},
+ {"proc_memory_maps", psutil_proc_memory_maps, METH_VARARGS},
+ {"proc_name_and_args", psutil_proc_name_and_args, METH_VARARGS},
+ {"proc_num_ctx_switches", psutil_proc_num_ctx_switches, METH_VARARGS},
+ {"query_process_thread", psutil_proc_query_thread, METH_VARARGS},
// --- system-related functions
- {"swap_mem", psutil_swap_mem, METH_VARARGS,
- "Return information about system swap memory."},
- {"users", psutil_users, METH_VARARGS,
- "Return currently connected users."},
- {"disk_partitions", psutil_disk_partitions, METH_VARARGS,
- "Return disk partitions."},
- {"per_cpu_times", psutil_per_cpu_times, METH_VARARGS,
- "Return system per-CPU times."},
- {"disk_io_counters", psutil_disk_io_counters, METH_VARARGS,
- "Return a Python dict of tuples for disk I/O statistics."},
- {"net_io_counters", psutil_net_io_counters, METH_VARARGS,
- "Return a Python dict of tuples for network I/O statistics."},
- {"boot_time", psutil_boot_time, METH_VARARGS,
- "Return system boot time in seconds since the EPOCH."},
- {"cpu_count_cores", psutil_cpu_count_cores, METH_VARARGS,
- "Return the number of CPU cores on the system."},
- {"net_connections", psutil_net_connections, METH_VARARGS,
- "Return TCP and UDP syste-wide open connections."},
- {"net_if_stats", psutil_net_if_stats, METH_VARARGS,
- "Return NIC stats (isup, duplex, speed, mtu)"},
- {"cpu_stats", psutil_cpu_stats, METH_VARARGS,
- "Return CPU statistics"},
+ {"boot_time", psutil_boot_time, METH_VARARGS},
+ {"cpu_count_cores", psutil_cpu_count_cores, METH_VARARGS},
+ {"cpu_stats", psutil_cpu_stats, METH_VARARGS},
+ {"disk_io_counters", psutil_disk_io_counters, METH_VARARGS},
+ {"disk_partitions", psutil_disk_partitions, METH_VARARGS},
+ {"net_connections", psutil_net_connections, METH_VARARGS},
+ {"net_if_stats", psutil_net_if_stats, METH_VARARGS},
+ {"net_io_counters", psutil_net_io_counters, METH_VARARGS},
+ {"per_cpu_times", psutil_per_cpu_times, METH_VARARGS},
+ {"swap_mem", psutil_swap_mem, METH_VARARGS},
+ {"users", psutil_users, METH_VARARGS},
// --- others
- {"set_debug", psutil_set_debug, METH_VARARGS,
- "Enable or disable PSUTIL_DEBUG messages"},
+ {"set_debug", psutil_set_debug, METH_VARARGS},
{NULL, NULL, 0, NULL}
};
diff --git a/psutil/_psutil_windows.c b/psutil/_psutil_windows.c
index 0e4da62f..5ce2ee02 100644
--- a/psutil/_psutil_windows.c
+++ b/psutil/_psutil_windows.c
@@ -1555,135 +1555,79 @@ static PyMethodDef
PsutilMethods[] = {
// --- per-process functions
{"proc_cmdline", (PyCFunction)(void(*)(void))psutil_proc_cmdline,
- METH_VARARGS | METH_KEYWORDS,
- "Return process cmdline as a list of cmdline arguments"},
- {"proc_environ", psutil_proc_environ, METH_VARARGS,
- "Return process environment data"},
- {"proc_exe", psutil_proc_exe, METH_VARARGS,
- "Return path of the process executable"},
- {"proc_kill", psutil_proc_kill, METH_VARARGS,
- "Kill the process identified by the given PID"},
- {"proc_times", psutil_proc_times, METH_VARARGS,
- "Return tuple of user/kern time for the given PID"},
- {"proc_memory_info", psutil_proc_memory_info, METH_VARARGS,
- "Return a tuple of process memory information"},
- {"proc_memory_uss", psutil_proc_memory_uss, METH_VARARGS,
- "Return the USS of the process"},
- {"proc_cwd", psutil_proc_cwd, METH_VARARGS,
- "Return process current working directory"},
- {"proc_suspend_or_resume", psutil_proc_suspend_or_resume, METH_VARARGS,
- "Suspend or resume a process"},
- {"proc_open_files", psutil_proc_open_files, METH_VARARGS,
- "Return files opened by process"},
- {"proc_username", psutil_proc_username, METH_VARARGS,
- "Return the username of a process"},
- {"proc_threads", psutil_proc_threads, METH_VARARGS,
- "Return process threads information as a list of tuple"},
- {"proc_wait", psutil_proc_wait, METH_VARARGS,
- "Wait for process to terminate and return its exit code."},
- {"proc_priority_get", psutil_proc_priority_get, METH_VARARGS,
- "Return process priority."},
- {"proc_priority_set", psutil_proc_priority_set, METH_VARARGS,
- "Set process priority."},
- {"proc_io_priority_get", psutil_proc_io_priority_get, METH_VARARGS,
- "Return process IO priority."},
- {"proc_io_priority_set", psutil_proc_io_priority_set, METH_VARARGS,
- "Set process IO priority."},
- {"proc_cpu_affinity_get", psutil_proc_cpu_affinity_get, METH_VARARGS,
- "Return process CPU affinity as a bitmask."},
- {"proc_cpu_affinity_set", psutil_proc_cpu_affinity_set, METH_VARARGS,
- "Set process CPU affinity."},
- {"proc_io_counters", psutil_proc_io_counters, METH_VARARGS,
- "Get process I/O counters."},
- {"proc_is_suspended", psutil_proc_is_suspended, METH_VARARGS,
- "Return True if one of the process threads is in a suspended state"},
- {"proc_num_handles", psutil_proc_num_handles, METH_VARARGS,
- "Return the number of handles opened by process."},
- {"proc_memory_maps", psutil_proc_memory_maps, METH_VARARGS,
- "Return a list of process's memory mappings"},
+ METH_VARARGS | METH_KEYWORDS},
+ {"proc_cpu_affinity_get", psutil_proc_cpu_affinity_get, METH_VARARGS},
+ {"proc_cpu_affinity_set", psutil_proc_cpu_affinity_set, METH_VARARGS},
+ {"proc_cwd", psutil_proc_cwd, METH_VARARGS},
+ {"proc_environ", psutil_proc_environ, METH_VARARGS},
+ {"proc_exe", psutil_proc_exe, METH_VARARGS},
+ {"proc_io_counters", psutil_proc_io_counters, METH_VARARGS},
+ {"proc_io_priority_get", psutil_proc_io_priority_get, METH_VARARGS},
+ {"proc_io_priority_set", psutil_proc_io_priority_set, METH_VARARGS},
+ {"proc_is_suspended", psutil_proc_is_suspended, METH_VARARGS},
+ {"proc_kill", psutil_proc_kill, METH_VARARGS},
+ {"proc_memory_info", psutil_proc_memory_info, METH_VARARGS},
+ {"proc_memory_maps", psutil_proc_memory_maps, METH_VARARGS},
+ {"proc_memory_uss", psutil_proc_memory_uss, METH_VARARGS},
+ {"proc_num_handles", psutil_proc_num_handles, METH_VARARGS},
+ {"proc_open_files", psutil_proc_open_files, METH_VARARGS},
+ {"proc_priority_get", psutil_proc_priority_get, METH_VARARGS},
+ {"proc_priority_set", psutil_proc_priority_set, METH_VARARGS},
+ {"proc_suspend_or_resume", psutil_proc_suspend_or_resume, METH_VARARGS},
+ {"proc_threads", psutil_proc_threads, METH_VARARGS},
+ {"proc_times", psutil_proc_times, METH_VARARGS},
+ {"proc_username", psutil_proc_username, METH_VARARGS},
+ {"proc_wait", psutil_proc_wait, METH_VARARGS},
// --- alternative pinfo interface
- {"proc_info", psutil_proc_info, METH_VARARGS,
- "Various process information"},
+ {"proc_info", psutil_proc_info, METH_VARARGS},
// --- system-related functions
- {"pids", psutil_pids, METH_VARARGS,
- "Returns a list of PIDs currently running on the system"},
- {"ppid_map", psutil_ppid_map, METH_VARARGS,
- "Return a {pid:ppid, ...} dict for all running processes"},
- {"pid_exists", psutil_pid_exists, METH_VARARGS,
- "Determine if the process exists in the current process list."},
- {"cpu_count_logical", psutil_cpu_count_logical, METH_VARARGS,
- "Returns the number of logical CPUs on the system"},
- {"GetLogicalProcessorInformationEx",
- psutil_GetLogicalProcessorInformationEx, METH_VARARGS,
- "Returns different CPU counts"},
- {"boot_time", psutil_boot_time, METH_VARARGS,
- "Return the system boot time expressed in seconds since the epoch."},
- {"virtual_mem", psutil_virtual_mem, METH_VARARGS,
- "Return the total amount of physical memory, in bytes"},
- {"cpu_times", psutil_cpu_times, METH_VARARGS,
- "Return system cpu times as a list"},
- {"per_cpu_times", psutil_per_cpu_times, METH_VARARGS,
- "Return system per-cpu times as a list of tuples"},
- {"disk_usage", psutil_disk_usage, METH_VARARGS,
- "Return path's disk total and free as a Python tuple."},
- {"net_io_counters", psutil_net_io_counters, METH_VARARGS,
- "Return dict of tuples of networks I/O information."},
- {"disk_io_counters", psutil_disk_io_counters, METH_VARARGS,
- "Return dict of tuples of disks I/O information."},
- {"users", psutil_users, METH_VARARGS,
- "Return a list of currently connected users."},
- {"disk_partitions", psutil_disk_partitions, METH_VARARGS,
- "Return disk partitions."},
- {"net_connections", psutil_net_connections, METH_VARARGS,
- "Return system-wide connections"},
- {"net_if_addrs", psutil_net_if_addrs, METH_VARARGS,
- "Return NICs addresses."},
- {"net_if_stats", psutil_net_if_stats, METH_VARARGS,
- "Return NICs stats."},
- {"cpu_stats", psutil_cpu_stats, METH_VARARGS,
- "Return NICs stats."},
- {"cpu_freq", psutil_cpu_freq, METH_VARARGS,
- "Return CPU frequency."},
- {"cpu_info", psutil_cpu_info, METH_VARARGS,
- "Return various CPU information."},
- {"init_loadavg_counter", (PyCFunction)psutil_init_loadavg_counter,
- METH_VARARGS,
- "Initializes the emulated load average calculator."},
- {"getloadavg", (PyCFunction)psutil_get_loadavg, METH_VARARGS,
- "Returns the emulated POSIX-like load average."},
- {"sensors_battery", psutil_sensors_battery, METH_VARARGS,
- "Return battery metrics usage."},
- {"getpagesize", psutil_getpagesize, METH_VARARGS,
- "Return system memory page size."},
+ {"boot_time", psutil_boot_time, METH_VARARGS},
+ {"cpu_count_cores", psutil_cpu_count_cores, METH_VARARGS},
+ {"cpu_count_logical", psutil_cpu_count_logical, METH_VARARGS},
+ {"cpu_freq", psutil_cpu_freq, METH_VARARGS},
+ {"cpu_info", psutil_cpu_info, METH_VARARGS},
+ {"cpu_stats", psutil_cpu_stats, METH_VARARGS},
+ {"cpu_times", psutil_cpu_times, METH_VARARGS},
+ {"disk_io_counters", psutil_disk_io_counters, METH_VARARGS},
+ {"disk_partitions", psutil_disk_partitions, METH_VARARGS},
+ {"disk_usage", psutil_disk_usage, METH_VARARGS},
+ {"getloadavg", (PyCFunction)psutil_get_loadavg, METH_VARARGS},
+ {"getpagesize", psutil_getpagesize, METH_VARARGS},
+ {"init_loadavg_counter", (PyCFunction)psutil_init_loadavg_counter, METH_VARARGS},
+ {"net_connections", psutil_net_connections, METH_VARARGS},
+ {"net_if_addrs", psutil_net_if_addrs, METH_VARARGS},
+ {"net_if_stats", psutil_net_if_stats, METH_VARARGS},
+ {"net_io_counters", psutil_net_io_counters, METH_VARARGS},
+ {"per_cpu_times", psutil_per_cpu_times, METH_VARARGS},
+ {"pid_exists", psutil_pid_exists, METH_VARARGS},
+ {"pids", psutil_pids, METH_VARARGS},
+ {"ppid_map", psutil_ppid_map, METH_VARARGS},
+ {"sensors_battery", psutil_sensors_battery, METH_VARARGS},
+ {"users", psutil_users, METH_VARARGS},
+ {"virtual_mem", psutil_virtual_mem, METH_VARARGS},
// --- windows services
- {"winservice_enumerate", psutil_winservice_enumerate, METH_VARARGS,
- "List all services"},
- {"winservice_query_config", psutil_winservice_query_config, METH_VARARGS,
- "Return service config"},
- {"winservice_query_status", psutil_winservice_query_status, METH_VARARGS,
- "Return service config"},
- {"winservice_query_descr", psutil_winservice_query_descr, METH_VARARGS,
- "Return the description of a service"},
- {"winservice_start", psutil_winservice_start, METH_VARARGS,
- "Start a service"},
- {"winservice_stop", psutil_winservice_stop, METH_VARARGS,
- "Stop a service"},
+ {"winservice_enumerate", psutil_winservice_enumerate, METH_VARARGS},
+ {"winservice_query_config", psutil_winservice_query_config, METH_VARARGS},
+ {"winservice_query_descr", psutil_winservice_query_descr, METH_VARARGS},
+ {"winservice_query_status", psutil_winservice_query_status, METH_VARARGS},
+ {"winservice_start", psutil_winservice_start, METH_VARARGS},
+ {"winservice_stop", psutil_winservice_stop, METH_VARARGS},
// --- windows API bindings
- {"QueryDosDevice", psutil_QueryDosDevice, METH_VARARGS,
- "QueryDosDevice binding"},
+ {"GetLogicalProcessorInformationEx", psutil_GetLogicalProcessorInformationEx, METH_VARARGS},
+ {"QueryDosDevice", psutil_QueryDosDevice, METH_VARARGS},
// --- others
- {"set_debug", psutil_set_debug, METH_VARARGS,
- "Enable or disable PSUTIL_DEBUG messages"},
+ {"set_debug", psutil_set_debug, METH_VARARGS},
{NULL, NULL, 0, NULL}
};
+
struct module_state {
PyObject *error;
};