Bug tracker at https://github.com/giampaolo/psutil/issues
XXXX-XX-XX
Enhancements
- 2471: use Vulture CLI tool to detect dead code.
Bug fixes
- 2470, [Linux]: users() may return "localhost" instead of the actual IP address of the user logged in.
2024-10-17
Enhancements
- 2366, [Windows]: drastically speedup process_iter(). We now determine process unique identity by using process "fast" create time method. This will considerably speedup those apps which use process_iter() only once, e.g. to look for a process with a certain name.
- 2446: use pytest instead of unittest.
- 2448: add
make install-sysdeps
target to install the necessary system dependencies (python-dev, gcc, etc.) on all supported UNIX flavors. - 2449: add
make install-pydeps-test
andmake install-pydeps-dev
targets. They can be used to install dependencies meant for running tests and for local development. They can also be installed viapip install .[test]
andpip install .[dev]
. - 2456: allow to run tests via
python3 -m psutil.tests
even ifpytest
module is not installed. This is useful for production environments that don't have pytest installed, but still want to be able to test psutil installation.
Bug fixes
- 2427: psutil (segfault) on import in the free-threaded (no GIL) version of Python 3.13. (patch by Sam Gross)
- 2455, [Linux]:
IndexError
may occur when reading /proc/pid/stat and field 40 (blkio_ticks) is missing. - 2457, [AIX]: significantly improve the speed of Process.open_files() for some edge cases.
- 2460, [OpenBSD]: Process.num_fds() and Process.open_files() may fail with NoSuchProcess for PID 0. Instead, we now return "null" values (0 and [] respectively).
2024-06-18
Enhancements
- 2109:
maxfile
andmaxpath
fields were removed from the namedtuple returned by disk_partitions(). Reason: on network filesystems (NFS) this can potentially take a very long time to complete. - 2366, [Windows]: log debug message when using slower process APIs.
- 2375, [macOS]: provide arm64 wheels. (patch by Matthieu Darbois)
- 2396: process_iter() no longer pre-emptively checks whether PIDs have been reused. This makes process_iter() around 20x times faster.
- 2396: a new
psutil.process_iter.cache_clear()
API can be used the clear process_iter() internal cache. - 2401, Support building with free-threaded CPython 3.13. (patch by Sam Gross)
- 2407: Process.connections() was renamed to Process.net_connections().
The old name is still available, but it's deprecated (triggers a
DeprecationWarning
) and will be removed in the future. - 2425: [Linux]: provide aarch64 wheels. (patch by Matthieu Darbois / Ben Raz)
Bug fixes
- 2250, [NetBSD]: Process.cmdline() sometimes fail with EBUSY. It usually happens for long cmdlines with lots of arguments. In this case retry getting the cmdline for up to 50 times, and return an empty list as last resort.
- 2254, [Linux]: offline cpus raise NotImplementedError in cpu_freq() (patch by Shade Gladden)
- 2272: Add pickle support to psutil Exceptions.
- 2359, [Windows], [CRITICAL]: pid_exists() disagrees with Process on whether a pid exists when ERROR_ACCESS_DENIED.
- 2360, [macOS]: can't compile on macOS < 10.13. (patch by Ryan Schmidt)
- 2362, [macOS]: can't compile on macOS 10.11. (patch by Ryan Schmidt)
- 2365, [macOS]: can't compile on macOS < 10.9. (patch by Ryan Schmidt)
- 2395, [OpenBSD]: pid_exists() erroneously return True if the argument is a thread ID (TID) instead of a PID (process ID).
- 2412, [macOS]: can't compile on macOS 10.4 PowerPC due to missing MNT_ constants.
Porting notes
Version 6.0.0 introduces some changes which affect backward compatibility:
- 2109: the namedtuple returned by disk_partitions()' no longer has
maxfile
andmaxpath
fields. - 2396: process_iter() no longer pre-emptively checks whether PIDs have been reused. If you want to check for PID reusage you are supposed to use Process.is_running() against the yielded Process instances. That will also automatically remove reused PIDs from process_iter() internal cache.
- 2407: Process.connections() was renamed to Process.net_connections().
The old name is still available, but it's deprecated (triggers a
DeprecationWarning
) and will be removed in the future.
2024-01-19
Enhancements
- 2343, [FreeBSD]: filter net_connections() returned list in C instead of Python, and avoid to retrieve unnecessary connection types unless explicitly asked. E.g., on an IDLE system with few IPv6 connections this will run around 4 times faster. Before all connection types (TCP, UDP, UNIX) were retrieved internally, even if only a portion was returned.
- 2342, [NetBSD]: same as above (#2343) but for NetBSD.
- 2349: adopted black formatting style.
Bug fixes
- 930, [NetBSD], [critical]: net_connections() implementation was broken. It could either leak memory or core dump.
- 2340, [NetBSD]: if process is terminated, Process.cwd() will return an empty string instead of raising NoSuchProcess.
- 2345, [Linux]: fix compilation on older compiler missing DUPLEX_UNKNOWN.
- 2222, [macOS]: cpu_freq() now returns fixed values for min and max frequencies in all Apple Silicon chips.
2023-12-17
Enhancements
- 2324: enforce Ruff rule raw-string-in-exception, which helps providing clearer tracebacks when exceptions are raised by psutil.
Bug fixes
- 2325, [PyPy]: psutil did not compile on PyPy due to missing PyErr_SetExcFromWindowsErrWithFilenameObject cPython API.
2023-10-15
Enhancements
- 1703: cpu_percent() and cpu_times_percent() are now thread safe,
meaning they can be called from different threads and still return
meaningful and independent results. Before, if (say) 10 threads called
cpu_percent(interval=None)
at the same time, only 1 thread out of 10 would get the right result. - 2266: if Process class is passed a very high PID, raise NoSuchProcess instead of OverflowError. (patch by Xuehai Pan)
- 2246: drop python 3.4 & 3.5 support. (patch by Matthieu Darbois)
- 2290: PID reuse is now pre-emptively checked for Process.ppid() and Process.parents().
- 2312: use
ruff
Python linter instead offlake8 + isort
. It's an order of magnitude faster + it adds a ton of new code quality checks.
Bug fixes
- 2195, [Linux]: no longer print exception at import time in case /proc/stat
can't be read due to permission error. Redirect it to
PSUTIL_DEBUG
instead. - 2241, [NetBSD]: can't compile On NetBSD 10.99.3/amd64. (patch by Thomas Klausner)
- 2245, [Windows]: fix var unbound error on possibly in swap_memory() (patch by student_2333)
- 2268:
bytes2human()
utility function was unable to properly represent negative values. - 2252, [Windows]: disk_usage() fails on Python 3.12+. (patch by Matthieu Darbois)
- 2284, [Linux]: Process.memory_full_info() may incorrectly raise
ZombieProcess if it's determined via
/proc/pid/smaps_rollup
. Instead we now fallback on reading/proc/pid/smaps
. - 2287, [OpenBSD], [NetBSD]: Process.is_running() erroneously return
False
for zombie processes, because creation time cannot be determined. - 2288, [Linux]: correctly raise ZombieProcess on Process.exe(), Process.cmdline() and Process.memory_maps() instead of returning a "null" value.
- 2290: differently from what stated in the doc, PID reuse is not pre-emptively checked for Process.nice() (set), Process.ionice(), (set), Process.cpu_affinity() (set), Process.rlimit() (set), Process.parent().
- 2308, [OpenBSD]: Process.threads() always fail with AccessDenied (also as root).
2023-04-17
Enhancements
- 2196: in case of exception, display a cleaner error traceback by hiding the KeyError bit deriving from a missed cache hit.
- 2217: print the full traceback when a DeprecationWarning or UserWarning is raised.
- 2230, [OpenBSD]: net_connections() implementation was rewritten from scratch: - We're now able to retrieve the path of AF_UNIX sockets (before it was an empty string) - The function is faster since it no longer iterates over all processes. - No longer produces duplicate connection entries.
- 2238: there are cases where Process.cwd() cannot be determined
(e.g. directory no longer exists), in which case we returned either
None
or an empty string. This was consolidated and we now return""
on all platforms. - 2239, [UNIX]: if process is a zombie, and we can only determine part of the its truncated Process.name() (15 chars), don't fail with ZombieProcess when we try to guess the full name from the Process.cmdline(). Just return the truncated name.
- 2240, [NetBSD], [OpenBSD]: add CI testing on every commit for NetBSD and OpenBSD platforms (python 3 only).
Bug fixes
- 1043, [OpenBSD] net_connections() returns duplicate entries.
- 1915, [Linux]: on certain kernels,
"MemAvailable"
field from/proc/meminfo
returns0
(possibly a kernel bug), in which case we calculate an approximation foravailable
memory which matches "free" CLI utility. - 2164, [Linux]: compilation fails on kernels < 2.6.27 (e.g. CentOS 5).
- 2186, [FreeBSD]: compilation fails with Clang 15. (patch by Po-Chuan Hsieh)
- 2191, [Linux]: disk_partitions(): do not unnecessarily read /proc/filesystems and raise AccessDenied unless user specified all=False argument.
- 2216, [Windows]: fix tests when running in a virtual environment (patch by Matthieu Darbois)
- 2225, [POSIX]: users() loses precision for
started
attribute (off by 1 minute). - 2229, [OpenBSD]: unable to properly recognize zombie processes. NoSuchProcess may be raised instead of ZombieProcess.
- 2231, [NetBSD]: available virtual_memory() is higher than total.
- 2234, [NetBSD]: virtual_memory() metrics are wrong: available and used are too high. We now match values shown by htop CLI utility.
- 2236, [NetBSD]: Process.num_threads() and Process.threads() return threads that are already terminated.
- 2237, [OpenBSD], [NetBSD]: Process.cwd() may raise
FileNotFoundError
if cwd no longer exists. Return an empty string instead.
2022-11-07
Enhancements
- 2102: use Limited API when building wheels with CPython 3.6+ on Linux, macOS and Windows. This allows to use pre-built wheels in all future versions of cPython 3. (patch by Matthieu Darbois)
Bug fixes
- 2077, [Windows]: Use system-level values for virtual_memory(). (patch by Daniel Widdis)
- 2156, [Linux]: compilation may fail on very old gcc compilers due to missing
SPEED_UNKNOWN
definition. (patch by Amir Rossert) - 2010, [macOS]: on MacOS, arm64
IFM_1000_TX
andIFM_1000_T
are the same value, causing a build failure. (patch by Lawrence D'Anna) - 2160, [Windows]: Get Windows percent swap usage from performance counters. (patch by Daniel Widdis)
2022-10-18
Enhancements
- 2040, [macOS]: provide wheels for arm64 architecture. (patch by Matthieu Darbois)
Bug fixes
- 2116, [macOS], [critical]: net_connections() fails with RuntimeError.
- 2135, [macOS]: Process.environ() may contain garbage data. Fix
out-of-bounds read around
sysctl_procargs
. (patch by Bernhard Urban-Forster) - 2138, [Linux], [critical]: can't compile psutil on Android due to
undefined
ethtool_cmd_speed
symbol. - 2142, [POSIX]: net_if_stats() 's
flags
on Python 2 returned unicode instead of str. (patch by Matthieu Darbois) - 2147, [macOS] Fix disk usage report on macOS 12+. (patch by Matthieu Darbois)
- 2150, [Linux] Process.threads() may raise
NoSuchProcess
. Fix race condition. (patch by Daniel Li) - 2153, [macOS] Fix race condition in test_posix.TestProcess.test_cmdline. (patch by Matthieu Darbois)
2022-09-04
Bug fixes
- 2093, [FreeBSD], [critical]: pids() may fail with ENOMEM. Dynamically
increase the
malloc()
buffer size until it's big enough. - 2095, [Linux]: net_if_stats() returns incorrect interface speed for 100GbE network cards.
- 2113, [FreeBSD], [critical]: virtual_memory() may raise ENOMEM due to
missing
#include <sys/param.h>
directive. (patch by Peter Jeremy) - 2128, [NetBSD]: swap_memory() was miscalculated. (patch by Thomas Klausner)
2022-05-20
Enhancements
- 1053: drop Python 2.6 support. (patches by Matthieu Darbois and Hugo van Kemenade)
- 2037: Add additional flags to net_if_stats.
- 2050, [Linux]: increase
read(2)
buffer size from 1k to 32k when reading/proc
pseudo files line by line. This should help having more consistent results. - 2057, [OpenBSD]: add support for cpu_freq().
- 2107, [Linux]: Process.memory_full_info() (reporting process USS/PSS/Swap
memory) now reads
/proc/pid/smaps_rollup
instead of/proc/pids/smaps
, which makes it 5 times faster.
Bug fixes
- 2048:
AttributeError
is raised ifpsutil.Error
class is raised manually and passed throughstr
. - 2049, [Linux]: cpu_freq() erroneously returns
curr
value in GHz whilemin
andmax
are in MHz. - 2050, [Linux]: virtual_memory() may raise
ValueError
if running in a LCX container.
2021-12-29
Enhancements
- 1851, [Linux]: cpu_freq() is slow on systems with many CPUs. Read current
frequency values for all CPUs from
/proc/cpuinfo
instead of opening many files in/sys
fs. (patch by marxin) - 1992: NoSuchProcess message now specifies if the PID has been reused.
- 1992: error classes (NoSuchProcess, AccessDenied, etc.) now have a better
formatted and separated
__repr__
and__str__
implementations. - 1996, [BSD]: add support for MidnightBSD. (patch by Saeed Rasooli)
- 1999, [Linux]: disk_partitions(): convert
/dev/root
device (an alias used on some Linux distros) to real root device path. - 2005:
PSUTIL_DEBUG
mode now prints file name and line number of the debug messages coming from C extension modules. - 2042: rewrite HISTORY.rst to use hyperlinks pointing to psutil API doc.
Bug fixes
- 1456, [macOS], [critical]: cpu_freq()
min
andmax
are set to 0 if can't be determined (instead of crashing). - 1512, [macOS]: sometimes Process.connections() will crash with
EOPNOTSUPP
for one connection; this is now ignored. - 1598, [Windows]: disk_partitions() only returns mountpoints on drives where it first finds one.
- 1874, [SunOS]: swap output error due to incorrect range.
- 1892, [macOS]: cpu_freq() broken on Apple M1.
- 1901, [macOS]: different functions, especially Process.open_files() and
Process.connections(), could randomly raise AccessDenied because the
internal buffer of
proc_pidinfo(PROC_PIDLISTFDS)
syscall was not big enough. We now dynamically increase the buffer size until it's big enough instead of giving up and raising AccessDenied, which was a fallback to avoid crashing. - 1904, [Windows]:
OpenProcess
fails withERROR_SUCCESS
due toGetLastError()
called aftersprintf()
. (patch by alxchk) - 1913, [Linux]: wait_procs() should catch
subprocess.TimeoutExpired
exception. - 1919, [Linux]: sensors_battery() can raise
TypeError
on PureOS. - 1921, [Windows]: swap_memory() shows committed memory instead of swap.
- 1940, [Linux]: psutil does not handle
ENAMETOOLONG
when accessing process file descriptors in procfs. (patch by Nikita Radchenko) - 1948, [critical]:
memoize_when_activated
decorator is not thread-safe. (patch by Xuehai Pan) - 1953, [Windows], [critical]: disk_partitions() crashes due to insufficient buffer len. (patch by MaWe2019)
- 1965, [Windows], [critical]: fix "Fatal Python error: deallocating None" when calling users() multiple times.
- 1980, [Windows]: 32bit / WoW64 processes fails to read Process.name() longer than 128 characters resulting in AccessDenied. This is now fixed. (patch by PetrPospisil)
- 1991, [critical]: process_iter() is not thread safe and can raise
TypeError
if invoked from multiple threads. - 1956, [macOS]: Process.cpu_times() reports incorrect timings on M1 machines. (patch by Olivier Dormond)
- 2023, [Linux]: cpu_freq() return order is wrong on systems with more than 9 CPUs.
2020-12-19
Enhancements
- 1863: disk_partitions() exposes 2 extra fields:
maxfile
andmaxpath
, which are the maximum file name and path name length. - 1872, [Windows]: added support for PyPy 2.7.
- 1879: provide pre-compiled wheels for Linux and macOS (yey!).
- 1880: get rid of Travis and Cirrus CI services (they are no longer free). CI testing is now done by GitHub Actions on Linux, macOS and FreeBSD (yes). AppVeyor is still being used for Windows CI.
Bug fixes
- 1708, [Linux]: get rid of sensors_temperatures() duplicates. (patch by Tim Schlueter).
- 1839, [Windows], [critical]: always raise AccessDenied instead of
WindowsError
when failing to query 64 processes from 32 bit ones by usingNtWoW64
APIs. - 1866, [Windows], [critical]: Process.exe(), Process.cmdline(), Process.environ() may raise "[WinError 998] Invalid access to memory location" on Python 3.9 / VS 2019.
- 1874, [SunOS]: wrong swap output given when encrypted column is present.
- 1875, [Windows], [critical]: Process.username() may raise
ERROR_NONE_MAPPED
if the SID has no corresponding account name. In this case AccessDenied is now raised. - 1886, [macOS]:
EIO
error may be raised on Process.cmdline() and Process.environ(). Now it gets translated into AccessDenied. - 1887, [Windows], [critical]:
OpenProcess
may fail with "[WinError 0] The operation completed successfully"." Turn it into AccessDenied or NoSuchProcess depending on whether the PID is alive. - 1891, [macOS]: get rid of deprecated
getpagesize()
.
2020-10-23
Enhancements
- 809, [FreeBSD]: add support for Process.rlimit().
- 893, [BSD]: add support for Process.environ() (patch by Armin Gruner)
- 1830, [POSIX]: net_if_stats()
isup
also checks whether the NIC is running (meaning Wi-Fi or ethernet cable is connected). (patch by Chris Burger) - 1837, [Linux]: improved battery detection and charge
secsleft
calculation (patch by aristocratos)
Bug fixes
- 1620, [Linux]: cpu_count() with
logical=False
result is incorrect on systems with more than one CPU socket. (patch by Vincent A. Arcila) - 1738, [macOS]: Process.exe() may raise
FileNotFoundError
if process is still alive but the exe file which launched it got deleted. - 1791, [macOS]: fix missing include for
getpagesize()
. - 1823, [Windows], [critical]: Process.open_files() may cause a segfault due to a NULL pointer.
- 1838, [Linux]: sensors_battery(): if percent can be determined but not
the remaining values, still return a result instead of
None
. (patch by aristocratos)
2020-07-15
Bug fixes
- wheels for 2.7 were inadvertently deleted.
2020-07-15
Enhancements
- 1729: parallel tests on POSIX (
make test-parallel
). They're twice as fast! - 1741, [POSIX]:
make build
now runs in parallel on Python >= 3.6 and it's about 15% faster. - 1747: Process.wait() return value is cached so that the exit code can be retrieved on then next call.
- 1747, [POSIX]: Process.wait() on POSIX now returns an enum, showing the
negative signal which was used to terminate the process. It returns something
like
<Negsignal.SIGTERM: -15>
. - 1747: Process class provides more info about the process on
str()
andrepr()
(status and exit code). - 1757: memory leak tests are now stable.
- 1768, [Windows]: added support for Windows Nano Server. (contributed by Julien Lebot)
Bug fixes
- 1726, [Linux]: cpu_freq() parsing should use spaces instead of tabs on ia64. (patch by Michał Górny)
- 1760, [Linux]: Process.rlimit() does not handle long long type properly.
- 1766, [macOS]: NoSuchProcess may be raised instead of ZombieProcess.
- 1781, [critical]: getloadavg() can crash the Python interpreter. (patch by Ammar Askar)
2020-02-18
Enhancements
- 1637, [SunOS]: add partial support for old SunOS 5.10 Update 0 to 3.
- 1648, [Linux]: sensors_temperatures() looks into an additional
/sys/device/
directory for additional data. (patch by Javad Karabi) - 1652, [Windows]: dropped support for Windows XP and Windows Server 2003. Minimum supported Windows version now is Windows Vista.
- 1671, [FreeBSD]: add CI testing/service for FreeBSD (Cirrus CI).
- 1677, [Windows]: Process.exe() will succeed for all process PIDs (instead of raising AccessDenied).
- 1679, [Windows]: net_connections() and Process.connections() are 10% faster.
- 1682, [PyPy]: added CI / test integration for PyPy via Travis.
- 1686, [Windows]: added support for PyPy on Windows.
- 1693, [Windows]: boot_time(), Process.create_time() and users()'s login time now have 1 micro second precision (before the precision was of 1 second).
Bug fixes
- 1538, [NetBSD]: Process.cwd() may return
ENOENT
instead of NoSuchProcess. - 1627, [Linux]: Process.memory_maps() can raise
KeyError
. - 1642, [SunOS]: querying basic info for PID 0 results in
FileNotFoundError
. - 1646, [FreeBSD], [critical]: many Process methods may cause a segfault due to a backward incompatible change in a C type on FreeBSD 12.0.
- 1656, [Windows]: Process.memory_full_info() raises AccessDenied even for the current user and os.getpid().
- 1660, [Windows]: Process.open_files() complete rewrite + check of errors.
- 1662, [Windows], [critical]: Process.exe() may raise "[WinError 0] The operation completed successfully".
- 1665, [Linux]: disk_io_counters() does not take into account extra fields added to recent kernels. (patch by Mike Hommey)
- 1672: use the right C type when dealing with PIDs (int or long). Thus far (long) was almost always assumed, which is wrong on most platforms.
- 1673, [OpenBSD]: Process.connections(), Process.num_fds() and Process.threads() returned improper exception if process is gone.
- 1674, [SunOS]: disk_partitions() may raise
OSError
. - 1684, [Linux]: disk_io_counters() may raise
ValueError
on systems not having/proc/diskstats
. - 1695, [Linux]: could not compile on kernels <= 2.6.13 due to
PSUTIL_HAVE_IOPRIO
not being defined. (patch by Anselm Kruis)
2019-11-26
Bug fixes
- 1630, [Windows], [critical]: can't compile source distribution due to C syntax error.
2019-11-25
Bug fixes
- 1179, [Linux]: Process.cmdline() now takes into account misbehaving processes renaming the command line and using inappropriate chars to separate args.
- 1616, [critical]: use of
Py_DECREF
instead ofPy_CLEAR
will result in doublefree()
and segfault (CVE-2019-18874). (patch by Riccardo Schirone) - 1619, [OpenBSD], [critical]: compilation fails due to C syntax error. (patch by Nathan Houghton)
2019-11-06
Bug fixes
- 1615: remove
pyproject.toml
as it was causing installation issues.
2019-11-04
Enhancements
- 1527, [Linux]: added Process.cpu_times()
iowait
counter, which is the time spent waiting for blocking I/O to complete. - 1565: add PEP 517/8 build backend and requirements specification for better pip integration. (patch by Bernát Gábor)
Bug fixes
- 875, [Windows], [critical]: Process.cmdline(), Process.environ() or
Process.cwd() may occasionally fail with
ERROR_PARTIAL_COPY
which now gets translated to AccessDenied. - 1126, [Linux], [critical]: Process.cpu_affinity() segfaults on CentOS 5 / manylinux. Process.cpu_affinity() support for CentOS 5 was removed.
- 1528, [AIX], [critical]: compilation error on AIX 7.2 due to 32 vs 64 bit differences. (patch by Arnon Yaari)
- 1535:
type
andfamily
fields returned by net_connections() are not always turned into enums. - 1536, [NetBSD]: Process.cmdline() erroneously raise ZombieProcess error if cmdline has non encodable chars.
- 1546: usage percent may be rounded to 0 on Python 2.
- 1552, [Windows]: getloadavg() math for calculating 5 and 15 mins values is incorrect.
- 1568, [Linux]: use CC compiler env var if defined.
- 1570, [Windows]:
NtWow64*
syscalls fail to raise the proper error code - 1585, [OSX]: avoid calling
close()
(in C) on possible negative integers. (patch by Athos Ribeiro) - 1606, [SunOS], [critical]: compilation fails on SunOS 5.10. (patch by vser1)
2019-06-11
Enhancements
- 1494, [AIX]: added support for Process.environ(). (patch by Arnon Yaari)
Bug fixes
- 1276, [AIX]: can't get whole Process.cmdline(). (patch by Arnon Yaari)
- 1501, [Windows]: Process.cmdline() and Process.exe() raise unhandled "WinError 1168 element not found" exceptions for "Registry" and "Memory Compression" pseudo processes on Windows 10.
- 1526, [NetBSD], [critical]: Process.cmdline() could raise
MemoryError
. (patch by Kamil Rytarowski)
2019-04-26
Enhancements
- 604, [Windows]: add new getloadavg(), returning system load average calculation, including on Windows (emulated). (patch by Ammar Askar)
- 1404, [Linux]: cpu_count() with
logical=False
uses a second method (read from/sys/devices/system/cpu/cpu[0-9]/topology/core_id
) in order to determine the number of CPU cores in case/proc/cpuinfo
does not provide this info. - 1458: provide coloured test output. Also show failures on
KeyboardInterrupt
. - 1464: various docfixes (always point to Python 3 doc, fix links, etc.).
- 1476, [Windows]: it is now possible to set process high I/O priority
(Process.ionice()). Also, I/O priority values are now exposed as 4 new
constants:
IOPRIO_VERYLOW
,IOPRIO_LOW
,IOPRIO_NORMAL
,IOPRIO_HIGH
. - 1478: add make command to re-run tests failed on last run.
Bug fixes
- 1223, [Windows]: boot_time() may return incorrect value on Windows XP.
- 1456, [Linux]: cpu_freq() returns
None
instead of 0.0 whenmin
andmax
fields can't be determined. (patch by Alex Manuskin) - 1462, [Linux]: (tests) make tests invariant to
LANG
setting (patch by Benjamin Drung) - 1463: cpu_distribution.py script was broken.
- 1470, [Linux]: disk_partitions(): fix corner case when
/etc/mtab
doesn't exist. (patch by Cedric Lamoriniere) - 1471, [SunOS]: Process.name() and Process.cmdline() can return
SystemError
. (patch by Daniel Beer) - 1472, [Linux]: cpu_freq() does not return all CPUs on Raspberry-pi 3.
- 1474: fix formatting of
psutil.tests()
which mimicsps aux
output. - 1475, [Windows], [critical]:
OSError.winerror
attribute wasn't properly checked resulting inWindowsError(ERROR_ACCESS_DENIED)
being raised instead of AccessDenied. - 1477, [Windows]: wrong or absent error handling for private
NTSTATUS
Windows APIs. Different process methods were affected by this. - 1480, [Windows], [critical]: cpu_count() with
logical=False
could cause a crash due to fixed read violation. (patch by Samer Masterson) - 1486, [AIX], [SunOS]:
AttributeError
when interacting with Process methods involved into Process.oneshot() context. - 1491, [SunOS]: net_if_addrs(): use
free()
againstifap
struct on error. (patch by Agnewee) - 1493, [Linux]: cpu_freq(): handle the case where
/sys/devices/system/cpu/cpufreq/
exists but it's empty.
2019-03-11
Bug fixes
- 1329, [AIX]: psutil doesn't compile on AIX 6.1. (patch by Arnon Yaari)
- 1448, [Windows], [critical]: crash on import due to
rtlIpv6AddressToStringA
not available on Wine. - 1451, [Windows], [critical]: Process.memory_full_info() segfaults.
NtQueryVirtualMemory
is now used instead ofQueryWorkingSet
to calculate USS memory.
2019-03-05
Enhancements
- 1379, [Windows]: Process.suspend() and Process.resume() now use
NtSuspendProcess
andNtResumeProcess
instead of stopping/resuming all threads of a process. This is faster and more reliable (aka this is what ProcessHacker does). - 1420, [Windows]: in case of exception disk_usage() now also shows the path name.
- 1422, [Windows]: Windows APIs requiring to be dynamically loaded from DLL libraries are now loaded only once on startup (instead of on per function call) significantly speeding up different functions and methods.
- 1426, [Windows]:
PAGESIZE
and number of processors is now calculated on startup. - 1428: in case of error, the traceback message now shows the underlying C function called which failed.
- 1433: new Process.parents() method. (idea by Ghislain Le Meur)
- 1437: pids() are returned in sorted order.
- 1442: Python 3 is now the default interpreter used by Makefile.
Bug fixes
- 1353: process_iter() is now thread safe (it rarely raised
TypeError
). - 1394, [Windows], [critical]: Process.name() and Process.exe() may
erroneously return "Registry" or fail with "[Error 0] The operation completed
successfully".
QueryFullProcessImageNameW
is now used instead ofGetProcessImageFileNameW
in order to prevent that. - 1411, [BSD]: lack of
Py_DECREF
could cause segmentation fault on process instantiation. - 1419, [Windows]: Process.environ() raises
NotImplementedError
when querying a 64-bit process in 32-bit-WoW mode. Now it raises AccessDenied. - 1427, [OSX]: Process.cmdline() and Process.environ() may erroneously
raise
OSError
on failedmalloc()
. - 1429, [Windows]:
SE DEBUG
was not properly set for current process. It is now, and it should result in less AccessDenied exceptions for low PID processes. - 1432, [Windows]: Process.memory_info_ex()'s USS memory is miscalculated
because we're not using the actual system
PAGESIZE
. - 1439, [NetBSD]: Process.connections() may return incomplete results if using Process.oneshot().
- 1447: original exception wasn't turned into NoSuchProcess / AccessDenied exceptions when using Process.oneshot() context manager.
Incompatible API changes
- 1291, [OSX], [critical]: Process.memory_maps() was removed because inherently broken (segfault) for years.
2019-02-15
Enhancements
- 1348, [Windows]: on Windows >= 8.1 if Process.cmdline() fails due to
ERROR_ACCESS_DENIED
attempt usingNtQueryInformationProcess
+ProcessCommandLineInformation
. (patch by EccoTheFlintstone)
Bug fixes
- 1394, [Windows]: Process.exe() returns "[Error 0] The operation completed successfully" when Python process runs in "Virtual Secure Mode".
- 1402: psutil exceptions'
repr()
show the internal private module path. - 1408, [AIX], [critical]: psutil won't compile on AIX 7.1 due to missing header. (patch by Arnon Yaari)
2019-01-23
Enhancements
- 1350, [FreeBSD]: added support for sensors_temperatures(). (patch by Alex Manuskin)
- 1352, [FreeBSD]: added support for cpu_freq(). (patch by Alex Manuskin)
Bug fixes
- 1111: Process.oneshot() is now thread safe.
- 1354, [Linux]: disk_io_counters() fails on Linux kernel 4.18+.
- 1357, [Linux]: Process.memory_maps() and Process.io_counters() methods are no longer exposed if not supported by the kernel.
- 1368, [Windows]: fix Process.ionice() mismatch. (patch by EccoTheFlintstone)
- 1370, [Windows]: improper usage of
CloseHandle()
may lead to override the original error code when raising an exception. - 1373, [critical]: incorrect handling of cache in Process.oneshot() context causes Process instances to return incorrect results.
- 1376, [Windows]:
OpenProcess
now usesPROCESS_QUERY_LIMITED_INFORMATION
access rights wherever possible, resulting in less AccessDenied exceptions being thrown for system processes. - 1376, [Windows]: check if variable is
NULL
beforefree()
ing it. (patch by EccoTheFlintstone)
2018-10-30
Enhancements
- 1197, [Linux]: cpu_freq() is now implemented by parsing
/proc/cpuinfo
in case/sys/devices/system/cpu/*
filesystem is not available. - 1310, [Linux]: sensors_temperatures() now parses
/sys/class/thermal
in case/sys/class/hwmon
fs is not available (e.g. Raspberry Pi). (patch by Alex Manuskin) - 1320, [POSIX]: better compilation support when using g++ instead of GCC. (patch by Jaime Fullaondo)
Bug fixes
- 715: do not print exception on import time in case cpu_times() fails.
- 1004, [Linux]: Process.io_counters() may raise
ValueError
. - 1277, [OSX]: available and used memory (virtual_memory()) metrics are not accurate.
- 1294, [Windows]: Process.connections() may sometimes fail with
intermittent
0xC0000001
. (patch by Sylvain Duchesne) - 1307, [Linux]: disk_partitions() does not honour PROCFS_PATH.
- 1320, [AIX]: system CPU times (cpu_times()) were being reported with ticks unit as opposed to seconds. (patch by Jaime Fullaondo)
- 1332, [OSX]: psutil debug messages are erroneously printed all the time. (patch by Ilya Yanok)
- 1346, [SunOS]: net_connections() returns an empty list. (patch by Oleksii Shevchuk)
2018-08-14
Enhancements
- 1286, [macOS]:
psutil.OSX
constant is now deprecated in favor of newpsutil.MACOS
. - 1309, [Linux]: added
psutil.STATUS_PARKED
constant for Process.status(). - 1321, [Linux]: add disk_io_counters() dual implementation relying on
/sys/block
filesystem in case/proc/diskstats
is not available. (patch by Lawrence Ye)
Bug fixes
- 1209, [macOS]: Process.memory_maps() may fail with
EINVAL
due to poortask_for_pid()
syscall. AccessDenied is now raised instead. - 1278, [macOS]: Process.threads() incorrectly return microseconds instead of seconds. (patch by Nikhil Marathe)
- 1279, [Linux], [macOS], [BSD]: net_if_stats() may return
ENODEV
. - 1294, [Windows]: Process.connections() may sometime fail with
MemoryError
. (patch by sylvainduchesne) - 1305, [Linux]: disk_io_counters() may report inflated r/w bytes values.
- 1309, [Linux]: Process.status() is unable to recognize
"idle"
and"parked"
statuses (returns"?"
). - 1313, [Linux]: disk_io_counters() can report inflated values due to counting base disk device and its partition(s) twice.
- 1323, [Linux]: sensors_temperatures() may fail with
ValueError
.
2018-06-07
Bug fixes
- 1258, [Windows], [critical]: Process.username() may cause a segfault (Python interpreter crash). (patch by Jean-Luc Migot)
- 1273: net_if_addrs() namedtuple's name has been renamed from
snic
tosnicaddr
. - 1274, [Linux]: there was a small chance Process.children() may swallow AccessDenied exceptions.
2018-04-14
Bug fixes
- 1268: setup.py's
extra_require
parameter requires latest setuptools version, breaking quite a lot of installations.
2018-04-13
Enhancements
- 1239, [Linux]: expose kernel
slab
memory field for virtual_memory(). (patch by Maxime Mouial)
Bug fixes
- 694, [SunOS]: Process.cmdline() could be truncated at the 15th character when
reading it from
/proc
. An extra effort is made by reading it from process address space first. (patch by Georg Sauthoff) - 771, [Windows]: cpu_count() (both logical and cores) return a wrong (smaller) number on systems using process groups (> 64 cores).
- 771, [Windows]: cpu_times() with
percpu=True
return fewer CPUs on systems using process groups (> 64 cores). - 771, [Windows]: cpu_stats() and cpu_freq() may return incorrect results on systems using process groups (> 64 cores).
- 1193, [SunOS]: return uid/gid from
/proc/pid/psinfo
if there aren't enough permissions for/proc/pid/cred
. (patch by Georg Sauthoff) - 1194, [SunOS]: return nice value from
psinfo
asgetpriority()
doesn't support real-time processes. (patch by Georg Sauthoff) - 1194, [SunOS]: fix double
free()
in Process.cpu_num(). (patch by Georg Sauthoff) - 1194, [SunOS]: fix undefined behavior related to strict-aliasing rules and warnings. (patch by Georg Sauthoff)
- 1210, [Linux]: cpu_percent() steal time may remain stuck at 100% due to Linux erroneously reporting a decreased steal time between calls. (patch by Arnon Yaari)
- 1216: fix compatibility with Python 2.6 on Windows (patch by Dan Vinakovsky)
- 1222, [Linux]: Process.memory_full_info() was erroneously summing "Swap:" and "SwapPss:". Same for "Pss:" and "SwapPss". Not anymore.
- 1224, [Windows]: Process.wait() may erroneously raise TimeoutExpired.
- 1238, [Linux]: sensors_battery() may return
None
in case battery is not listed as "BAT0" under/sys/class/power_supply
. - 1240, [Windows]: cpu_times() float loses accuracy in a long running system. (patch by stswandering)
- 1245, [Linux]: sensors_temperatures() may fail with
IOError
"no such file". - 1255, [FreeBSD]: swap_memory() stats were erroneously represented in KB. (patch by Denis Krienbühl)
Backward compatibility
- 771, [Windows]: cpu_count() with
logical=False
on Windows XP and Vista is no longer supported and returnsNone
.
2018-01-01
Enhancements
- 775: disk_partitions() on Windows return mount points.
Bug fixes
2017-12-07
Enhancements
- 1173: introduced
PSUTIL_DEBUG
environment variable which can be set in order to print useful debug messages on stderr (useful in case of nasty errors). - 1177, [macOS]: added support for sensors_battery(). (patch by Arnon Yaari)
- 1183: Process.children() is 2x faster on POSIX and 2.4x faster on Linux.
- 1188: deprecated method Process.memory_info_ex() now warns by using
FutureWarning
instead ofDeprecationWarning
.
Bug fixes
- 1152, [Windows]: disk_io_counters() may return an empty dict.
- 1169, [Linux]: users()
hostname
returns username instead. (patch by janderbrain) - 1172, [Windows]:
make test
does not work. - 1179, [Linux]: Process.cmdline() is now able to split cmdline args for
misbehaving processes which overwrite
/proc/pid/cmdline
and use spaces instead of null bytes as args separator. - 1181, [macOS]: Process.memory_maps() may raise
ENOENT
. - 1187, [macOS]: pids() does not return PID 0 on recent macOS versions.
2017-11-08
Enhancements
- 1164, [AIX]: add support for Process.num_ctx_switches(). (patch by Arnon Yaari)
- 1053: drop Python 3.3 support (psutil still works but it's no longer tested).
Bug fixes
- 1150, [Windows]: when a process is terminated now the exit code is set to
SIGTERM
instead of0
. (patch by Akos Kiss) - 1151:
python -m psutil.tests
fail. - 1154, [AIX], [critical]: psutil won't compile on AIX 6.1.0. (patch by Arnon Yaari)
- 1167, [Windows]: net_io_counters() packets count now include also non-unicast packets. (patch by Matthew Long)
2017-10-12
Enhancements
- 1123, [AIX]: added support for AIX platform. (patch by Arnon Yaari)
Bug fixes
- 1009, [Linux]: sensors_temperatures() may crash with
IOError
. - 1012, [Windows]: disk_io_counters()
read_time
andwrite_time
were expressed in tens of micro seconds instead of milliseconds. - 1127, [macOS], [critical]: invalid reference counting in Process.open_files() may lead to segfault. (patch by Jakub Bacic)
- 1129, [Linux]: sensors_fans() may crash with
IOError
. (patch by Sebastian Saip) - 1131, [SunOS]: fix compilation warnings. (patch by Arnon Yaari)
- 1133, [Windows]: can't compile on newer versions of Visual Studio 2017 15.4. (patch by Max Bélanger)
- 1138, [Linux]: can't compile on CentOS 5.0 and RedHat 5.0. (patch by Prodesire)
2017-09-10
Enhancements
- 1124: documentation moved to http://psutil.readthedocs.io
Bug fixes
- 1105, [FreeBSD]: psutil does not compile on FreeBSD 12.
- 1125, [BSD]: net_connections() raises
TypeError
.
Compatibility notes
- 1120:
.exe
files for Windows are no longer uploaded on PyPI as per PEP-527. Only wheels are provided.
2017-09-01
Enhancements
- 802: disk_io_counters() and net_io_counters() numbers no longer wrap
(restart from 0). Introduced a new
nowrap
argument. - 928: net_connections() and Process.connections()
laddr
andraddr
are now named tuples. - 1015: swap_memory() now relies on
/proc/meminfo
instead ofsysinfo()
syscall so that it can be used in conjunction with PROCFS_PATH in order to retrieve memory info about Linux containers such as Docker and Heroku. - 1022: users() provides a new
pid
field. - 1025: process_iter() accepts two new parameters in order to invoke
Process.as_dict():
attrs
andad_value
. With these you can iterate over all processes in one shot without needing to catch NoSuchProcess and do list/dict comprehensions. - 1040: implemented full unicode support.
- 1051: disk_usage() on Python 3 is now able to accept bytes.
- 1058: test suite now enables all warnings by default.
- 1060: source distribution is dynamically generated so that it only includes relevant files.
- 1079, [FreeBSD]: net_connections()
fd
number is now being set for real (instead of-1
). (patch by Gleb Smirnoff) - 1091, [SunOS]: implemented Process.environ(). (patch by Oleksii Shevchuk)
Bug fixes
- 989, [Windows]: boot_time() may return a negative value.
- 1007, [Windows]: boot_time() can have a 1 sec fluctuation between calls. The value of the first call is now cached so that boot_time() always returns the same value if fluctuation is <= 1 second.
- 1013, [FreeBSD]: net_connections() may return incorrect PID. (patch by Gleb Smirnoff)
- 1014, [Linux]: Process class can mask legitimate
ENOENT
exceptions as NoSuchProcess. - 1016: disk_io_counters() raises
RuntimeError
on a system with no disks. - 1017: net_io_counters() raises
RuntimeError
on a system with no network cards installed. - 1021, [Linux]: Process.open_files() may erroneously raise NoSuchProcess instead of skipping a file which gets deleted while open files are retrieved.
- 1029, [macOS], [FreeBSD]: Process.connections() with
family=unix
on Python 3 doesn't properly handle unicode paths and may raiseUnicodeDecodeError
. - 1033, [macOS], [FreeBSD]: memory leak for net_connections() and
Process.connections() when retrieving UNIX sockets (
kind='unix'
). - 1040: fixed many unicode related issues such as
UnicodeDecodeError
on Python 3 + POSIX and invalid encoded data on Windows. - 1042, [FreeBSD], [critical]: psutil won't compile on FreeBSD 12.
- 1044, [macOS]: different Process methods incorrectly raise AccessDenied for zombie processes.
- 1046, [Windows]: disk_partitions() on Windows overrides user's
SetErrorMode
. - 1047, [Windows]: Process.username(): memory leak in case exception is thrown.
- 1048, [Windows]: users()
host
field report an invalid IP address. - 1050, [Windows]: Process.memory_maps() leaks memory.
- 1055: cpu_count() is no longer cached. This is useful on systems such as Linux where CPUs can be disabled at runtime. This also reflects on Process.cpu_percent() which no longer uses the cache.
- 1058: fixed Python warnings.
- 1062: disk_io_counters() and net_io_counters() raise
TypeError
if no disks or NICs are installed on the system. - 1063, [NetBSD]: net_connections() may list incorrect sockets.
- 1064, [NetBSD], [critical]: swap_memory() may segfault in case of error.
- 1065, [OpenBSD], [critical]: Process.cmdline() may raise
SystemError
. - 1067, [NetBSD]: Process.cmdline() leaks memory if process has terminated.
- 1069, [FreeBSD]: Process.cpu_num() may return 255 for certain kernel processes.
- 1071, [Linux]: cpu_freq() may raise
IOError
on old RedHat distros. - 1074, [FreeBSD]: sensors_battery() raises
OSError
in case of no battery. - 1075, [Windows]: net_if_addrs():
inet_ntop()
return value is not checked. - 1077, [SunOS]: net_if_addrs() shows garbage addresses on SunOS 5.10. (patch by Oleksii Shevchuk)
- 1077, [SunOS]: net_connections() does not work on SunOS 5.10. (patch by Oleksii Shevchuk)
- 1079, [FreeBSD]: net_connections() didn't list locally connected sockets. (patch by Gleb Smirnoff)
- 1085: cpu_count() return value is now checked and forced to
None
if <= 1. - 1087: Process.cpu_percent() guard against cpu_count() returning
None
and assumes 1 instead. - 1093, [SunOS]: Process.memory_maps() shows wrong 64 bit addresses.
- 1094, [Windows]: pid_exists() may lie. Also, all process APIs relying
on
OpenProcess
Windows API now check whether the PID is actually running. - 1098, [Windows]: Process.wait() may erroneously return sooner, when the PID is still alive.
- 1099, [Windows]: Process.terminate() may raise AccessDenied even if the process already died.
- 1101, [Linux]: sensors_temperatures() may raise
ENODEV
.
Porting notes
- 1039: returned types consolidation. 1) Windows / Process.cpu_times():
fields #3 and #4 were int instead of float. 2) Linux / FreeBSD / OpenBSD:
Process.connections()
raddr
is now set to""
instead ofNone
when retrieving UNIX sockets. - 1040: all strings are encoded by using OS fs encoding.
- 1040: the following Windows APIs on Python 2 now return a string instead of
unicode:
Process.memory_maps().path
,WindowsService.bin_path()
,WindowsService.description()
,WindowsService.display_name()
,WindowsService.username()
.
2017-04-10
Bug fixes
- 1000: fixed some setup.py warnings.
- 1002, [SunOS]: remove C macro which will not be available on new Solaris versions. (patch by Danek Duvall)
- 1004, [Linux]: Process.io_counters() may raise
ValueError
. - 1006, [Linux]: cpu_freq() may return
None
on some Linux versions does not support the function. Let's not make the function available instead. - 1009, [Linux]: sensors_temperatures() may raise
OSError
. - 1010, [Linux]: virtual_memory() may raise
ValueError
on Ubuntu 14.04.
2017-03-24
Bug fixes
- 981, [Linux]: cpu_freq() may return an empty list.
- 993, [Windows]: Process.memory_maps() on Python 3 may raise
UnicodeDecodeError
. - 996, [Linux]: sensors_temperatures() may not show all temperatures.
- 997, [FreeBSD]: virtual_memory() may fail due to missing
sysctl
parameter on FreeBSD 12.
2017-03-05
Enhancements
- 971, [Linux]: Add sensors_fans() function. (patch by Nicolas Hennion)
- 976, [Windows]: Process.io_counters() has 2 new fields:
other_count
andother_bytes
. - 976, [Linux]: Process.io_counters() has 2 new fields:
read_chars
andwrite_chars
.
Bug fixes
- 872, [Linux]: can now compile on Linux by using MUSL C library.
- 985, [Windows]: Fix a crash in Process.open_files() when the worker thread
for
NtQueryObject
times out. - 986, [Linux]: Process.cwd() may raise NoSuchProcess instead of ZombieProcess.
Bug fixes
- 971, [Linux]: sensors_temperatures() didn't work on CentOS 7.
- 973, [critical]: cpu_percent() may raise
ZeroDivisionError
.
2017-02-03
Bug fixes
- 966, [Linux]: sensors_battery()
power_plugged
may erroneously returnNone
on Python 3. - 968, [Linux]: disk_io_counters() raises
TypeError
on Python 3. - 970, [Linux]: sensors_battery()
name
andlabel
fields on Python 3 are bytes instead of str.
2017-02-03
Enhancements
- 966, [Linux]: sensors_battery()
percent
is a float and is more precise.
Bug fixes
- 964, [Windows]: Process.username() and users() may return badly decoded character on Python 3.
- 965, [Linux]: disk_io_counters() may miscalculate sector size and report the wrong number of bytes read and written.
- 966, [Linux]: sensors_battery() may fail with
FileNotFoundError
. - 966, [Linux]: sensors_battery()
power_plugged
may lie.
2017-02-01
Enhancements
- 357: added Process.cpu_num() (what CPU a process is on).
- 371: added sensors_temperatures() (Linux only).
- 941: added cpu_freq() (CPU frequency).
- 955: added sensors_battery() (Linux, Windows, only).
- 956: Process.cpu_affinity() can now be passed
[]
argument as an alias to set affinity against all eligible CPUs.
Bug fixes
- 687, [Linux]: pid_exists() no longer returns
True
if passed a process thread ID. - 948: cannot install psutil with
PYTHONOPTIMIZE=2
. - 950, [Windows]: Process.cpu_percent() was calculated incorrectly and showed higher number than real usage.
- 951, [Windows]: the uploaded wheels for Python 3.6 64 bit didn't work.
- 959: psutil exception objects could not be pickled.
- 960: psutil.Popen
wait()
did not return the correct negative exit status if process is killed by a signal. - 961, [Windows]:
WindowsService.description()
method may fail withERROR_MUI_FILE_NOT_FOUND
.
2016-12-21
Enhancements
- 939: tar.gz distribution went from 1.8M to 258K.
- 811, [Windows]: provide a more meaningful error message if trying to use psutil on unsupported Windows XP.
Bug fixes
- 609, [SunOS], [critical]: psutil does not compile on Solaris 10.
- 936, [Windows]: fix compilation error on VS 2013 (patch by Max Bélanger).
- 940, [Linux]: cpu_percent() and cpu_times_percent() was calculated
incorrectly as
iowait
,guest
andguest_nice
times were not properly taken into account. - 944, [OpenBSD]: pids() was omitting PID 0.
2016-11-06
Enhncements
- 799: new Process.oneshot() context manager making Process methods around +2x faster in general and from +2x to +6x faster on Windows.
- 943: better error message in case of version conflict on import.
Bug fixes
- 932, [NetBSD]: net_connections() and Process.connections() may fail without raising an exception.
- 933, [Windows]: memory leak in cpu_stats() and
WindowsService.description()
method.
2016-10-26
Bug fixes
- 931, [critical]: psutil no longer compiles on Solaris.
2016-10-25
Bug fixes
- 927, [critical]: psutil.Popen
__del__
may cause maximum recursion depth error.
2016-10-23
Enhancements
- 874, [Windows]: make net_if_addrs() also return the
netmask
. - 887, [Linux]: virtual_memory()
available
andused
values are more precise and matchfree
cmdline utility.available
also takes into account LCX containers preventingavailable
to overflowtotal
. - 891: procinfo.py script has been updated and provides a lot more info.
Bug fixes
- 514, [macOS], [critical]: Process.memory_maps() can segfault.
- 783, [macOS]: Process.status() may erroneously return
"running"
for zombie processes. - 798, [Windows]: Process.open_files() returns and empty list on Windows 10.
- 825, [Linux]: Process.cpu_affinity(): fix possible double close and use of unopened socket.
- 880, [Windows]: fix race condition inside net_connections().
- 885:
ValueError
is raised if a negative integer is passed to cpu_percent() functions. - 892, [Linux], [critical]: Process.cpu_affinity() with
[-1]
as arg raisesSystemError
with no error set; nowValueError
is raised. - 906, [BSD]: disk_partitions() with
all=False
returned an empty list. Now the argument is ignored and all partitions are always returned. - 907, [FreeBSD]: Process.exe() may fail with
OSError(ENOENT)
. - 908, [macOS], [BSD]: different process methods could errounesuly mask the real
error for high-privileged PIDs and raise NoSuchProcess and AccessDenied
instead of
OSError
andRuntimeError
. - 909, [macOS]: Process.open_files() and Process.connections() methods
may raise
OSError
with no exception set if process is gone. - 916, [macOS]: fix many compilation warnings.
2016-09-01
Enhancements
- 881:
make install
now works also when using a virtual env.
Bug fixes
- 854: Process.as_dict() raises
ValueError
if passed an erroneous attrs name. - 857, [SunOS]: Process.cpu_times(), Process.cpu_percent(),
Process.threads() and Process.memory_maps() may raise
RuntimeError
if attempting to query a 64bit process with a 32bit Python. "Null" values are returned as a fallback. - 858: Process.as_dict() should not call Process.memory_info_ex() because it's deprecated.
- 863, [Windows]: Process.memory_maps() truncates addresses above 32 bits.
- 866, [Windows]: win_service_iter() and services in general are not able to handle unicode service names / descriptions.
- 869, [Windows]: Process.wait() may raise TimeoutExpired with wrong timeout unit (ms instead of sec).
- 870, [Windows]: handle leak inside
psutil_get_process_data
.
2016-06-18
Enhancements
- 819, [Linux]: different speedup improvements: Process.ppid() +20% faster. Process.status() +28% faster. Process.name() +25% faster. Process.num_threads() +20% faster on Python 3.
Bug fixes
- 810, [Windows]: Windows wheels are incompatible with pip 7.1.2.
- 812, [NetBSD], [critical]: fix compilation on NetBSD-5.x.
- 823, [NetBSD]: virtual_memory() raises
TypeError
on Python 3. - 829, [POSIX]: disk_usage()
percent
field takes root reserved space into account. - 816, [Windows]: fixed net_io_counters() values wrapping after 4.3GB in Windows Vista (NT 6.0) and above using 64bit values from newer win APIs.
2016-05-14
Enhancements
- 795, [Windows]: new APIs to deal with Windows services: win_service_iter() and win_service_get().
- 800, [Linux]: virtual_memory() returns a new
shared
memory field. - 819, [Linux]: speedup
/proc
parsing: Process.ppid() +20% faster. Process.status() +28% faster. Process.name() +25% faster. Process.num_threads() +20% faster on Python 3.
Bug fixes
- 797, [Linux]: net_if_stats() may raise
OSError
for certain NIC cards. - 813: Process.as_dict() should ignore extraneous attribute names which gets attached to the Process instance.
2016-03-12
Enhancements
- 777, [Linux]: Process.open_files() on Linux return 3 new fields:
position
,mode
andflags
. - 779: Process.cpu_times() returns two new fields,
children_user
andchildren_system
(always set to 0 on macOS and Windows). - 789, [Windows]: cpu_times() return two new fields:
interrupt
anddpc
. Same for cpu_times_percent(). - 792: new cpu_stats() function returning number of CPU
ctx_switches
,interrupts
,soft_interrupts
andsyscalls
.
Bug fixes
- 774, [FreeBSD]: net_io_counters() dropout is no longer set to 0 if the kernel provides it.
- 776, [Linux]: Process.cpu_affinity() may erroneously raise NoSuchProcess. (patch by wxwright)
- 780, [macOS]: psutil does not compile with some GCC versions.
- 786: net_if_addrs() may report incomplete MAC addresses.
- 788, [NetBSD]: virtual_memory()
buffers
andshared
values were set to 0. - 790, [macOS], [critical]: psutil won't compile on macOS 10.4.
2016-02-17
Enhancements
- 523, [Linux], [FreeBSD]: disk_io_counters() return a new
busy_time
field. - 660, [Windows]: make.bat is smarter in finding alternative VS install locations. (patch by mpderbec)
- 732: Process.environ(). (patch by Frank Benkstein)
- 753, [Linux], [macOS], [Windows]: process USS and PSS (Linux) "real" memory stats. (patch by Eric Rahm)
- 755: Process.memory_percent()
memtype
parameter. - 758: tests now live in psutil namespace.
- 760: expose OS constants (
psutil.LINUX
,psutil.OSX
, etc.) - 756, [Linux]: disk_io_counters() return 2 new fields:
read_merged_count
andwrite_merged_count
. - 762: new procsmem.py script.
Bug fixes
- 685, [Linux]: virtual_memory() provides wrong results on systems with a lot of physical memory.
- 704, [SunOS]: psutil does not compile on Solaris sparc.
- 734: on Python 3 invalid UTF-8 data is not correctly handled for
Process.name(), Process.cwd(), Process.exe(), Process.cmdline()
and Process.open_files() methods resulting in
UnicodeDecodeError
exceptions.'surrogateescape'
error handler is now used as a workaround for replacing the corrupted data. - 737, [Windows]: when the bitness of psutil and the target process was different, Process.cmdline() and Process.cwd() could return a wrong result or incorrectly report an AccessDenied error.
- 741, [OpenBSD]: psutil does not compile on mips64.
- 751, [Linux]: fixed call to
Py_DECREF
on possibleNULL
object. - 754, [Linux]: Process.cmdline() can be wrong in case of zombie process.
- 759, [Linux]: Process.memory_maps() may return paths ending with
" (deleted)"
. - 761, [Windows]: boot_time() wraps to 0 after 49 days.
- 764, [NetBSD]: fix compilation on NetBSD-6.x.
- 766, [Linux]: net_connections() can't handle malformed
/proc/net/unix
file. - 767, [Linux]: disk_io_counters() may raise
ValueError
on 2.6 kernels and it's broken on 2.4 kernels. - 770, [NetBSD]: disk_io_counters() metrics didn't update.
2016-01-20
Enhancements
- 728, [SunOS]: exposed PROCFS_PATH constant to change the default
location of
/proc
filesystem.
Bug fixes
- 724, [FreeBSD]: virtual_memory()
total
is incorrect. - 730, [FreeBSD], [critical]: virtual_memory() crashes with "OSError: [Errno 12] Cannot allocate memory".
2016-01-15
Enhancements
- 557, [NetBSD]: added NetBSD support. (contributed by Ryo Onodera and Thomas Klausner)
- 708, [Linux]: net_connections() and Process.connections() on Python 2 can be up to 3x faster in case of many connections. Also Process.memory_maps() is slightly faster.
- 718: process_iter() is now thread safe.
Bug fixes
- 714, [OpenBSD]: virtual_memory()
cached
value was always set to 0. - 715, [critical]: don't crash at import time if cpu_times() fail for some reason.
- 717, [Linux]: Process.open_files() fails if deleted files still visible.
- 722, [Linux]: swap_memory() no longer crashes if
sin
/sout
can't be determined due to missing/proc/vmstat
. - 724, [FreeBSD]: virtual_memory()
total
is slightly incorrect.
2015-11-25
Enhancements
- 558, [Linux]: exposed PROCFS_PATH constant to change the default
location of
/proc
filesystem. - 615, [OpenBSD]: added OpenBSD support. (contributed by Landry Breuil)
Bug fixes
- 692, [POSIX]: Process.name() is no longer cached as it may change.
2015-10-04
Bug fixes
- 517, [SunOS]: net_io_counters() failed to detect network interfaces correctly on Solaris 10
- 541, [FreeBSD]: disk_io_counters() r/w times were expressed in seconds instead of milliseconds. (patch by dasumin)
- 610, [SunOS]: fix build and tests on Solaris 10
- 623, [Linux]: process or system connections raises
ValueError
if IPv6 is not supported by the system. - 678, [Linux], [critical]: can't install psutil due to bug in setup.py.
- 688, [Windows]: compilation fails with MSVC 2015, Python 3.5. (patch by Mike Sarahan)
2015-09-03
Bug fixes
- 677, [Linux], [critical]: can't install psutil due to bug in setup.py.
2015-09-02
Enhancements
- 644, [Windows]: added support for
CTRL_C_EVENT
andCTRL_BREAK_EVENT
signals to use with Process.send_signal(). - 648: CI test integration for macOS. (patch by Jeff Tang)
- 663, [POSIX]: net_if_addrs() now returns point-to-point (VPNs) addresses.
- 655, [Windows]: different issues regarding unicode handling were fixed. On Python 2 all APIs returning a string will now return an encoded version of it by using sys.getfilesystemencoding() codec. The APIs involved are: net_if_addrs(), net_if_stats(), net_io_counters(), Process.cmdline(), Process.name(), Process.username(), users().
Bug fixes
- 513, [Linux]: fixed integer overflow for
RLIM_INFINITY
. - 641, [Windows]: fixed many compilation warnings. (patch by Jeff Tang)
- 652, [Windows]: net_if_addrs()
UnicodeDecodeError
in case of non-ASCII NIC names. - 655, [Windows]: net_if_stats()
UnicodeDecodeError
in case of non-ASCII NIC names. - 659, [Linux]: compilation error on Suse 10. (patch by maozguttman)
- 664, [Linux]: compilation error on Alpine Linux. (patch by Bart van Kleef)
- 670, [Windows]: segfgault of net_if_addrs() in case of non-ASCII NIC names. (patch by sk6249)
- 672, [Windows]: compilation fails if using Windows SDK v8.0. (patch by Steven Winfield)
- 675, [Linux]: net_connections():
UnicodeDecodeError
may occur when listing UNIX sockets.
2015-07-15
Bug fixes
- 603, [Linux]: Process.ionice() set value range is incorrect. (patch by spacewander)
- 645, [Linux]: cpu_times_percent() may produce negative results.
- 656:
from psutil import *
does not work.
2015-07-15
Enhancements
- 534, [Linux]: disk_partitions() added support for ZFS filesystems.
- 646, [Windows]: continuous tests integration for Windows with https://ci.appveyor.com/project/giampaolo/psutil.
- 647: new dev guide: https://github.com/giampaolo/psutil/blob/master/docs/DEVGUIDE.rst
- 651: continuous code quality test integration with scrutinizer-ci.com
Bug fixes
- 340, [Windows], [critical]: Process.open_files() no longer hangs. Instead it uses a thread which times out and skips the file handle in case it's taking too long to be retrieved. (patch by Jeff Tang)
- 627, [Windows]: Process.name() no longer raises AccessDenied for pids owned by another user.
- 636, [Windows]: Process.memory_info() raise AccessDenied.
- 637, [POSIX]: raise exception if trying to send signal to PID 0 as it will
affect
os.getpid()
's process group and not PID 0. - 639, [Linux]: Process.cmdline() can be truncated.
- 640, [Linux]:
*connections
functions may swallow errors and return an incomplete list of connections. - 642:
repr()
of exceptions is incorrect. - 653, [Windows]: add
inet_ntop()
function for Windows XP to support IPv6. - 641, [Windows]: replace deprecated string functions with safe equivalents.
2015-06-18
Bug fixes
- 632, [Linux]: better error message if cannot parse process UNIX connections.
- 634, [Linux]: Process.cmdline() does not include empty string arguments.
- 635, [POSIX], [critical]: crash on module import if
enum
package is installed on Python < 3.4.
2015-06-13
Enhancements
- 250: new net_if_stats() returning NIC statistics (
isup
,duplex
,speed
,mtu
). - 376: new net_if_addrs() returning all NIC addresses a-la
ifconfig
. - 469: on Python >= 3.4
IOPRIO_CLASS_*
and*_PRIORITY_CLASS
constants returned by Process.ionice() and Process.nice() are enums instead of plain integers. - 581: add
.gitignore
. (patch by Gabi Davar) - 582: connection constants returned by net_connections() and Process.connections() were turned from int to enums on Python > 3.4.
- 587: move native extension into the package.
- 589: Process.cpu_affinity() accepts any kind of iterable (set, tuple, ...), not only lists.
- 594: all deprecated APIs were removed.
- 599, [Windows]: Process.name() can now be determined for all processes even when running as a limited user.
- 602: pre-commit GIT hook.
- 629: enhanced support for
pytest
andnose
test runners. - 616, [Windows]: add
inet_ntop()
function for Windows XP.
Bug fixes
- 428, [POSIX], [critical]: correct handling of zombie processes on POSIX. Introduced new ZombieProcess exception class.
- 512, [BSD], [critical]: fix segfault in net_connections().
- 555, [Linux]: users() correctly handles
":0"
as an alias for"localhost"
. - 579, [Windows]: fixed Process.open_files() for PID > 64K.
- 579, [Windows]: fixed many compiler warnings.
- 585, [FreeBSD]: net_connections() may raise
KeyError
. - 586, [FreeBSD], [critical]: Process.cpu_affinity() segfaults on set in case an invalid CPU number is provided.
- 593, [FreeBSD], [critical]: Process.memory_maps() segfaults.
- 606: Process.parent() may swallow NoSuchProcess exceptions.
- 611, [SunOS]: net_io_counters() has send and received swapped
- 614, [Linux]:: cpu_count() with
logical=False
return the number of sockets instead of cores. - 618, [SunOS]: swap tests fail on Solaris when run as normal user.
- 628, [Linux]: Process.name() truncates string in case it contains spaces or parentheses.
2015-02-02
Bug fixes
- 572, [Linux]: fix "ValueError: ambiguous inode with multiple PIDs references" for Process.connections(). (patch by Bruno Binet)
2015-01-06
Enhancements
- 521: drop support for Python 2.4 and 2.5.
- 553: new pstree.py script.
- 564: C extension version mismatch in case the user messed up with psutil installation or with sys.path is now detected at import time.
- 568: new pidof.py script.
- 569, [FreeBSD]: add support for Process.cpu_affinity() on FreeBSD.
Bug fixes
- 496, [SunOS], [critical]: can't import psutil.
- 547, [POSIX]: Process.username() may raise
KeyError
if UID can't be resolved. - 551, [Windows]: get rid of the unicode hack for net_io_counters() NIC names.
- 556, [Linux]: lots of file handles were left open.
- 561, [Linux]: net_connections() might skip some legitimate UNIX sockets. (patch by spacewander)
- 565, [Windows]: use proper encoding for Process.username() and users(). (patch by Sylvain Mouquet)
- 567, [Linux]: in the alternative implementation of Process.cpu_affinity()
PyList_Append
andPy_BuildValue
return values are not checked. - 569, [FreeBSD]: fix memory leak in cpu_count() with
logical=False
. - 571, [Linux]: Process.open_files() might swallow AccessDenied exceptions and return an incomplete list of open files.
2014-09-26
- 536, [Linux], [critical]: fix "undefined symbol: CPU_ALLOC" compilation error.
2014-09-21
Enhancements
- 407: project moved from Google Code to Github; code moved from Mercurial to Git.
- 492: use
tox
to run tests on multiple Python versions. (patch by msabramo) - 505, [Windows]: distribution as wheel packages.
- 511: add ps.py script.
Bug fixes
- 340, [Windows]: Process.open_files() no longer hangs. (patch by Jeff Tang)
- 501, [Windows]: disk_io_counters() may return negative values.
- 503, [Linux]: in rare conditions Process.exe(), Process.open_files() and
Process.connections() can raise
OSError(ESRCH)
instead of NoSuchProcess. - 504, [Linux]: can't build RPM packages via setup.py
- 506, [Linux], [critical]: Python 2.4 support was broken.
- 522, [Linux]: Process.cpu_affinity() might return
EINVAL
. (patch by David Daeschler) - 529, [Windows]: Process.exe() may raise unhandled
WindowsError
exception for PIDs 0 and 4. (patch by Jeff Tang) - 530, [Linux]: disk_io_counters() may crash on old Linux distros (< 2.6.5) (patch by Yaolong Huang)
- 533, [Linux]: Process.memory_maps() may raise
TypeError
on old Linux distros.
2014-04-30
Bug fixes
- 446, [Windows]: fix encoding error when using net_io_counters() on Python 3. (patch by Szigeti Gabor Niif)
- 460, [Windows]: net_io_counters() wraps after 4G.
- 491, [Linux]: net_connections() exceptions. (patch by Alexander Grothe)
2014-04-08
Enhancements
- 387: system-wide open connections a-la
netstat
(add net_connections()).
Bug fixes
- 421, [SunOS], [critical]: psutil does not compile on SunOS 5.10. (patch by Naveed Roudsari)
- 489, [Linux]: disk_partitions() return an empty list.
2014-03-10
Enhancements
- 424, [Windows]: installer for Python 3.X 64 bit.
- 427: number of logical CPUs and physical cores (cpu_count()).
- 447: wait_procs()
timeout
parameter is now optional. - 452: make Process instances hashable and usable with
set()
s. - 453: tests on Python < 2.7 require
unittest2
module. - 459: add a Makefile for running tests and other repetitive tasks (also on Windows).
- 463: make timeout parameter of
cpu_percent*
functions default to0.0
'cause it's a common trap to introduce slowdowns. - 468: move documentation to readthedocs.com.
- 477: Process.cpu_percent() is about 30% faster. (suggested by crusaderky)
- 478, [Linux]: almost all APIs are about 30% faster on Python 3.X.
- 479: long deprecated
psutil.error
module is gone; exception classes now live in psutil namespace only.
Bug fixes
- 193: psutil.Popen constructor can throw an exception if the spawned process terminates quickly.
- 340, [Windows]: Process.open_files() no longer hangs. (patch by [email protected])
- 443, [Linux]: fix a potential overflow issue for Process.cpu_affinity() (set) on systems with more than 64 CPUs.
- 448, [Windows]: Process.children() and Process.ppid() memory leak (patch by Ulrich Klank).
- 457, [POSIX]: pid_exists() always returns
True
for PID 0. - 461: namedtuples are not pickle-able.
- 466, [Linux]: Process.exe() improper null bytes handling. (patch by Gautam Singh)
- 470: wait_procs() might not wait. (patch by crusaderky)
- 471, [Windows]: Process.exe() improper unicode handling. (patch by [email protected])
- 473: psutil.Popen
wait()
method does not set returncode attribute. - 474, [Windows]: Process.cpu_percent() is no longer capped at 100%.
- 476, [Linux]: encoding error for Process.name() and Process.cmdline().
API changes
For the sake of consistency a lot of psutil APIs have been renamed.
In most cases accessing the old names will work but it will cause a
DeprecationWarning
.
psutil.*
module level constants have being replaced by functions:Old name
Replacement
psutil.NUM_CPUS
psutil.cpu_count()
psutil.BOOT_TIME
psutil.boot_time()
psutil.TOTAL_PHYMEM
virtual_memory.total
Renamed
psutil.*
functions:Old name
Replacement
psutil.get_pid_list()
psutil.pids()
psutil.get_users()
psutil.users()
psutil.get_boot_time()
psutil.boot_time()
All Process
get_*
methods lost theget_
prefix. E.g.get_ext_memory_info()
was renamed tomemory_info_ex()
. Assumingp = psutil.Process()
:Old name
Replacement
p.get_children()
p.children()
p.get_connections()
p.connections()
p.get_cpu_affinity()
p.cpu_affinity()
p.get_cpu_percent()
p.cpu_percent()
p.get_cpu_times()
p.cpu_times()
p.get_ext_memory_info()
p.memory_info_ex()
p.get_io_counters()
p.io_counters()
p.get_ionice()
p.ionice()
p.get_memory_info()
p.memory_info()
p.get_memory_maps()
p.memory_maps()
p.get_memory_percent()
p.memory_percent()
p.get_nice()
p.nice()
p.get_num_ctx_switches()
p.num_ctx_switches()
p.get_num_fds()
p.num_fds()
p.get_num_threads()
p.num_threads()
p.get_open_files()
p.open_files()
p.get_rlimit()
p.rlimit()
p.get_threads()
p.threads()
p.getcwd()
p.cwd()
All Process
set_*
methods lost theset_
prefix. Assumingp = psutil.Process()
:Old name
Replacement
p.set_nice()
p.nice(value)
p.set_ionice()
p.ionice(ioclass, value=None)
p.set_cpu_affinity()
p.cpu_affinity(cpus)
p.set_rlimit()
p.rlimit(resource, limits=None)
Except for
pid
, all Process class properties have been turned into methods. This is the only case which there are no aliases. Assumingp = psutil.Process()
:Old name
Replacement
p.name
p.name()
p.parent
p.parent()
p.ppid
p.ppid()
p.exe
p.exe()
p.cmdline
p.cmdline()
p.status
p.status()
p.uids
p.uids()
p.gids
p.gids()
p.username
p.username()
p.create_time
p.create_time()
timeout parameter of
cpu_percent*
functions defaults to 0.0 instead of 0.1.long deprecated
psutil.error
module is gone; exception classes now live in "psutil" namespace only.Process instances'
retcode
attribute returned by wait_procs() has been renamed toreturncode
for consistency withsubprocess.Popen
.
2013-11-25
Bug fixes
- 348, [Windows], [critical]: fixed "ImportError: DLL load failed" occurring on module import on Windows XP.
- 425, [SunOS], [critical]: crash on import due to failure at determining
BOOT_TIME
. - 443, [Linux]: Process.cpu_affinity() can't set affinity on systems with more than 64 cores.
2013-11-20
Enhancements
- 439: assume
os.getpid()
if no argument is passed to Process class constructor. - 440: new wait_procs() utility function which waits for multiple processes to terminate.
Bug fixes
- 348, [Windows]: fix "ImportError: DLL load failed" occurring on module import on Windows XP / Vista.
2013-11-07
Bug fixes
- 442, [Linux], [critical]: psutil won't compile on certain version of
Linux because of missing
prlimit(2)
syscall.
2013-10-22
Bug fixes
- 442, [Linux], [critical]: psutil won't compile on Debian 6.0 because of
missing
prlimit(2)
syscall.
2013-10-08
Bug fixes
- 442, [Linux], [critical]: psutil won't compile on kernels < 2.6.36 due
to missing
prlimit(2)
syscall.
2013-09-28
Enhancements
- 410: host tar.gz and Windows binary files are on PyPI.
- 412, [Linux]: get/set process resource limits (Process.rlimit()).
- 415, [Windows]: Process.children() is an order of magnitude faster.
- 426, [Windows]: Process.name() is an order of magnitude faster.
- 431, [POSIX]: Process.name() is slightly faster because it unnecessarily retrieved also Process.cmdline().
Bug fixes
- 391, [Windows]: cpu_times_percent() returns negative percentages.
- 408:
STATUS_*
andCONN_*
constants don't properly serialize on JSON. - 411, [Windows]: disk_usage.py may pop-up a GUI error.
- 413, [Windows]: Process.memory_info() leaks memory.
- 414, [Windows]: Process.exe() on Windows XP may raise
ERROR_INVALID_PARAMETER
. - 416: disk_usage() doesn't work well with unicode path names.
- 430, [Linux]: Process.io_counters() report wrong number of r/w syscalls.
- 435, [Linux]: net_io_counters() might report erreneous NIC names.
- 436, [Linux]: net_io_counters() reports a wrong
dropin
value.
API changes
- 408: turn
STATUS_*
andCONN_*
constants into plain Python strings.
2013-07-12
Bug fixes
- 405: net_io_counters()
pernic=True
no longer works as intended in 1.0.0.
2013-07-10
Enhancements
- 18, [SunOS]: add Solaris support (yay!) (thanks Justin Venus)
- 367: Process.connections()
status
strings are now constants. - 380: test suite exits with non-zero on failure. (patch by floppymaster)
- 391: introduce unittest2 facilities and provide workarounds if unittest2 is not installed (Python < 2.7).
Bug fixes
- 374, [Windows]: negative memory usage reported if process uses a lot of memory.
- 379, [Linux]: Process.memory_maps() may raise
ValueError
. - 394, [macOS]: mapped memory regions of Process.memory_maps() report incorrect file name.
- 404, [Linux]:
sched_*affinity()
are implicitly declared. (patch by Arfrever)
API changes
- Process.connections()
status
field is no longer a string but a constant object (psutil.CONN_*
). - Process.connections()
local_address
andremote_address
fields renamed toladdr
andraddr
. - psutil.network_io_counters() renamed to net_io_counters().
2013-05-03
Bug fixes
- 325, [BSD], [critical]: virtual_memory() can raise
SystemError
. (patch by Jan Beich) - 370, [BSD]: Process.connections() requires root. (patch by John Baldwin)
- 372, [BSD]: different process methods raise NoSuchProcess instead of AccessDenied.
2013-04-12
Enhancements
- 233: code migrated to Mercurial (yay!)
- 246: psutil.error module is deprecated and scheduled for removal.
- 328, [Windows]: Process.ionice() support.
- 359: add boot_time() as a substitute of
psutil.BOOT_TIME
since the latter cannot reflect system clock updates. - 361, [Linux]: cpu_times() now includes new
steal
,guest
andguest_nice
fields available on recent Linux kernels. Also, cpu_percent() is more accurate. - 362: add cpu_times_percent() (per-CPU-time utilization as a percentage).
Bug fixes
- 234, [Windows]: disk_io_counters() fails to list certain disks.
- 264, [Windows]: use of disk_partitions() may cause a message box to appear.
- 313, [Linux], [critical]: virtual_memory() and swap_memory() can
crash on certain exotic Linux flavors having an incomplete
/proc
interface. If that's the case we now set the unretrievable stats to0
and raiseRuntimeWarning
instead. - 315, [macOS]: fix some compilation warnings.
- 317, [Windows]: cannot set process CPU affinity above 31 cores.
- 319, [Linux]: Process.memory_maps() raises
KeyError
'Anonymous' on Debian squeeze. - 321, [POSIX]: Process.ppid() property is no longer cached as the kernel may set the PPID to 1 in case of a zombie process.
- 323, [macOS]: disk_io_counters()
read_time
andwrite_time
parameters were reporting microseconds not milliseconds. (patch by Gregory Szorc) - 331: Process.cmdline() is no longer cached after first access as it may change.
- 333, [macOS]: leak of Mach ports (patch by [email protected])
- 337, [Linux], [critical]: Process methods not working because of a
poor
/proc
implementation will raiseNotImplementedError
rather thanRuntimeError
and Process.as_dict() will not blow up. (patch by Curtin1060) - 338, [Linux]: disk_io_counters() fails to find some disks.
- 339, [FreeBSD]:
get_pid_list()
can allocate all the memory on system. - 341, [Linux], [critical]: psutil might crash on import due to error in retrieving system terminals map.
- 344, [FreeBSD]: swap_memory() might return incorrect results due to
kvm_open(3)
not being called. (patch by Jean Sebastien) - 338, [Linux]: disk_io_counters() fails to find some disks.
- 351, [Windows]: if psutil is compiled with MinGW32 (provided installers for py2.4 and py2.5 are) disk_io_counters() will fail. (Patch by m.malycha)
- 353, [macOS]: users() returns an empty list on macOS 10.8.
- 356: Process.parent() now checks whether parent PID has been reused in which
case returns
None
. - 365: Process.nice() (set) should check PID has not been reused by another process.
- 366, [FreeBSD], [critical]: Process.memory_maps(), Process.num_fds(),
Process.open_files() and Process.cwd() methods raise
RuntimeError
instead of AccessDenied.
API changes
- Process.cmdline() property is no longer cached after first access.
- Process.ppid() property is no longer cached after first access.
- [Linux] Process methods not working because of a poor
/proc
implementation will raiseNotImplementedError
instead ofRuntimeError
. psutil.error
module is deprecated and scheduled for removal.
2012-08-16
Enhancements
- 316: Process.cmdline() property now makes a better job at guessing the process executable from the cmdline.
Bug fixes
- 316: Process.exe() was resolved in case it was a symlink.
- 318, [critical]: Python 2.4 compatibility was broken.
API changes
- Process.exe() can now return an empty string instead of raising AccessDenied.
- Process.exe() is no longer resolved in case it's a symlink.
2012-08-13
Enhancements
- 216, [POSIX]: Process.connections() UNIX sockets support.
- 220, [FreeBSD]:
get_connections()
has been rewritten in C and no longer requireslsof
. - 222, [macOS]: add support for Process.cwd().
- 261: per-process extended memory info (Process.memory_info_ex()).
- 295, [macOS]: Process.exe() path is now determined by asking the OS instead of being guessed from Process.cmdline().
- 297, [macOS]: the Process methods below were always raising AccessDenied for any process except the current one. Now this is no longer true. Also they are 2.5x faster. Process.name(), Process.memory_info(), Process.memory_percent(), Process.cpu_times(), Process.cpu_percent(), Process.num_threads().
- 300: add pmap.py script.
- 301: process_iter() now yields processes sorted by their PIDs.
- 302: per-process number of voluntary and involuntary context switches (Process.num_ctx_switches()).
- 303, [Windows]: the Process methods below were always raising AccessDenied for any process not owned by current user. Now this is no longer true: Process.create_time(), Process.cpu_times(), Process.cpu_percent(), Process.memory_info(), Process.memory_percent(), Process.num_handles(), Process.io_counters().
- 305: add netstat.py script.
- 311: system memory functions has been refactorized and rewritten and now provide a more detailed and consistent representation of the system memory. Added new virtual_memory() and swap_memory() functions. All old memory-related functions are deprecated. Also two new example scripts were added: free.py and meminfo.py.
- 312:
net_io_counters()
namedtuple includes 4 new fields:errin
,errout
,dropin
anddropout
, reflecting the number of packets dropped and with errors.
Bug fixes
- 298, [macOS], [BSD]: memory leak in Process.num_fds().
- 299: potential memory leak every time
PyList_New(0)
is used. - 303, [Windows], [critical]: potential heap corruption in Process.num_threads() and Process.status() methods.
- 305, [FreeBSD], [critical]: can't compile on FreeBSD 9 due to removal of
utmp.h
. - 306, [critical]: at C level, errors are not checked when invoking
Py*
functions which create or manipulate Python objects leading to potential memory related errors and/or segmentation faults. - 307, [FreeBSD]: values returned by net_io_counters() are wrong.
- 308, [BSD], [Windows]:
psutil.virtmem_usage()
wasn't actually returning information about swap memory usage as it was supposed to do. It does now. - 309: Process.open_files() might not return files which can not be accessed due to limited permissions. AccessDenied is now raised instead.
API changes
psutil.phymem_usage()
is deprecated (use virtual_memory())psutil.virtmem_usage()
is deprecated (use swap_memory())- [Linux]:
psutil.phymem_buffers()
is deprecated (use virtual_memory()) - [Linux]:
psutil.cached_phymem()
is deprecated (use virtual_memory()) - [Windows], [BSD]:
psutil.virtmem_usage()
now returns information about swap memory instead of virtual memory.
2012-06-29
Enhancements
- 293, [Windows]: Process.exe() path is now determined by asking the OS instead of being guessed from Process.cmdline().
Bug fixes
- 292, [Linux]: race condition in process Process.open_files(), Process.connections(), Process.threads().
- 294, [Windows]: Process.cpu_affinity() is only able to set CPU #0.
2012-06-27
Enhancements
- 195, [Windows]: number of handles opened by process (Process.num_handles()).
- 209: disk_partitions() now provides also mount options.
- 229: list users currently connected on the system (users()).
- 238, [Linux], [Windows]: process CPU affinity (get and set, Process.cpu_affinity()).
- 242: add
recursive=True
to Process.children(): return all process descendants. - 245, [POSIX]: Process.wait() incrementally consumes less CPU cycles.
- 257, [Windows]: removed Windows 2000 support.
- 258, [Linux]: Process.memory_info() is now 0.5x faster.
- 260: process's mapped memory regions. (Windows patch by wj32.64, macOS patch by Jeremy Whitlock)
- 262, [Windows]: disk_partitions() was slow due to inspecting the
floppy disk drive also when parameter is
all=False
. - 273:
psutil.get_process_list()
is deprecated. - 274: psutil no longer requires
2to3
at installation time in order to work with Python 3. - 278: new Process.as_dict() method.
- 281: Process.ppid(), Process.name(), Process.exe(), Process.cmdline() and Process.create_time() properties of Process class are now cached after being accessed.
- 282:
psutil.STATUS_*
constants can now be compared by using their string representation. - 283: speedup Process.is_running() by caching its return value in case the process is terminated.
- 284, [POSIX]: per-process number of opened file descriptors (Process.num_fds()).
- 287: process_iter() now caches Process instances between calls.
- 290: Process.nice() property is deprecated in favor of new
get_nice()
andset_nice()
methods.
Bug fixes
- 193: psutil.Popen constructor can throw an exception if the spawned process terminates quickly.
- 240, [macOS]: incorrect use of
free()
for Process.connections(). - 244, [POSIX]: Process.wait() can hog CPU resources if called against a process which is not our children.
- 248, [Linux]: net_io_counters() might return erroneous NIC names.
- 252, [Windows]: Process.cwd() erroneously raise NoSuchProcess for processes owned by another user. It now raises AccessDenied instead.
- 266, [Windows]:
psutil.get_pid_list()
only shows 1024 processes. (patch by Amoser) - 267, [macOS]: Process.connections() returns wrong remote address. (Patch by Amoser)
- 272, [Linux]: Process.open_files() potential race condition can lead to unexpected NoSuchProcess exception. Also, we can get incorrect reports of not absolutized path names.
- 275, [Linux]:
Process.io_counters()
erroneously raise NoSuchProcess on old Linux versions. Where not available it now raisesNotImplementedError
. - 286: Process.is_running() doesn't actually check whether PID has been reused.
- 314: Process.children() can sometimes return non-children.
API changes
Process.nice
property is deprecated in favor of newget_nice()
andset_nice()
methods.psutil.get_process_list()
is deprecated.- Process.ppid(), Process.name(), Process.exe(), Process.cmdline() and Process.create_time() properties of Process class are now cached after being accessed, meaning NoSuchProcess will no longer be raised in case the process is gone in the meantime.
psutil.STATUS_*
constants can now be compared by using their string representation.
2011-12-14
Bug fixes
- 228: some example scripts were not working with Python 3.
- 230, [Windows], [macOS]: fix memory leak in Process.connections().
- 232, [Linux]:
psutil.phymem_usage()
can report erroneous values which are different thanfree
command. - 236, [Windows]: fix memory/handle leak in Process.memory_info(), Process.suspend() and Process.resume() methods.
2011-10-29
Enhancements
- 150: network I/O counters (net_io_counters()). (macOS and Windows patch by Jeremy Whitlock)
- 154, [FreeBSD]: add support for Process.cwd().
- 157, [Windows]: provide installer for Python 3.2 64-bit.
- 198: Process.wait() with
timeout=0
can now be used to make the function return immediately. - 206: disk I/O counters (disk_io_counters()). (macOS and Windows patch by Jeremy Whitlock)
- 213: add iotop.py script.
- 217: Process.connections() now has a
kind
argument to filter for connections with different criteria. - 221, [FreeBSD]: Process.open_files() has been rewritten in C and no longer
relies on
lsof
. - 223: add top.py script.
- 227: add nettop.py script.
Bug fixes
- 135, [macOS]: psutil cannot create Process object.
- 144, [Linux]: no longer support 0 special PID.
- 188, [Linux]: psutil import error on Linux ARM architectures.
- 194, [POSIX]: Process.cpu_percent() now reports a percentage over 100 on multicore processors.
- 197, [Linux]: Process.connections() is broken on platforms not supporting IPv6.
- 200, [Linux], [critical]:
psutil.NUM_CPUS
not working on armel and sparc architectures and causing crash on module import. - 201, [Linux]: Process.connections() is broken on big-endian architectures.
- 211: Process instance can unexpectedly raise NoSuchProcess if tested for equality with another object.
- 218, [Linux], [critical]: crash at import time on Debian 64-bit because
of a missing line in
/proc/meminfo
. - 226, [FreeBSD], [critical]: crash at import time on FreeBSD 7 and minor.
2011-07-08
Enhancements
- 125: system per-cpu percentage utilization and times (Process.cpu_times(), Process.cpu_percent()).
- 163: per-process associated terminal / TTY (Process.terminal()).
- 171: added
get_phymem()
andget_virtmem()
functions returning system memory information (total
,used
,free
) and memory percent usage.total_*
,avail_*
andused_*
memory functions are deprecated. - 172: disk usage statistics (disk_usage()).
- 174: mounted disk partitions (disk_partitions()).
- 179: setuptools is now used in setup.py
Bug fixes
- 159, [Windows]:
SetSeDebug()
does not close handles or unset impersonation on return. - 164, [Windows]: wait function raises a
TimeoutException
when a process returns-1
. - 165: Process.status() raises an unhandled exception.
- 166: Process.memory_info() leaks handles hogging system resources.
- 168: cpu_percent() returns erroneous results when used in non-blocking mode. (patch by Philip Roberts)
- 178, [macOS]: Process.threads() leaks memory.
- 180, [Windows]: Process.num_threads() and Process.threads() methods can raise NoSuchProcess exception while process still exists.
2011-03-20
Enhancements
- 64: per-process I/O counters (Process.io_counters()).
- 116: per-process Process.wait() (wait for process to terminate and return its exit code).
- 134: per-process threads (Process.threads()).
- 136: Process.exe() path on FreeBSD is now determined by asking the kernel instead of guessing it from cmdline[0].
- 137: per-process real, effective and saved user and group ids (Process.gids()).
- 140: system boot time (boot_time()).
- 142: per-process get and set niceness (priority) (Process.nice()).
- 143: per-process status (Process.status()).
- 147 [Linux]: per-process I/O niceness / priority (Process.ionice()).
- 148: psutil.Popen class which tidies up
subprocess.Popen
and Process class in a single interface. - 152, [macOS]: Process.open_files() implementation has been rewritten
in C and no longer relies on
lsof
resulting in a 3x speedup. - 153, [macOS]: Process.connections() implementation has been rewritten
in C and no longer relies on
lsof
resulting in a 3x speedup.
Bug fixes
- 83, [macOS]: Process.cmdline() is empty on macOS 64-bit.
- 130, [Linux]: a race condition can cause
IOError
exception be raised on if process disappears betweenopen()
and the subsequentread()
call. - 145, [Windows], [critical]:
WindowsError
was raised instead of AccessDenied when using Process.resume() or Process.suspend(). - 146, [Linux]: Process.exe() property can raise
TypeError
if path contains NULL bytes. - 151, [Linux]: Process.exe() and Process.cwd() for PID 0 return inconsistent data.
API changes
- Process
uid
andgid
properties are deprecated in favor ofuids
andgids
properties.
2010-11-13
Enhancements
- 79: per-process open files (Process.open_files()).
- 88: total system physical cached memory.
- 88: total system physical memory buffers used by the kernel.
- 91: add Process.send_signal() and Process.terminate() methods.
- 95: NoSuchProcess and AccessDenied exception classes now provide
pid
,name
andmsg
attributes. - 97: per-process children (Process.children()).
- 98: Process.cpu_times() and Process.memory_info() now return a namedtuple instead of a tuple.
- 103: per-process opened TCP and UDP connections (Process.connections()).
- 107, [Windows]: add support for Windows 64 bit. (patch by cjgohlke)
- 111: per-process executable name (Process.exe()).
- 113: exception messages now include Process.name() and Process.pid.
- 114, [Windows]: Process.username() has been rewritten in pure C and no longer uses WMI resulting in a big speedup. Also, pywin32 is no longer required as a third-party dependency. (patch by wj32)
- 117, [Windows]: added support for Windows 2000.
- 123: cpu_percent() and Process.cpu_percent() accept a
new
interval
parameter. - 129: per-process threads (Process.threads()).
Bug fixes
- 80: fixed warnings when installing psutil with easy_install.
- 81, [Windows]: psutil fails to compile with Visual Studio.
- 94: Process.suspend() raises
OSError
instead of AccessDenied. - 86, [FreeBSD]: psutil didn't compile against FreeBSD 6.x.
- 102, [Windows]: orphaned process handles obtained by using
OpenProcess
in C were left behind every time Process class was instantiated. - 111, [POSIX]:
path
andname
Process properties report truncated or erroneous values on POSIX. - 120, [macOS]: cpu_percent() always returning 100%.
- 112:
uid
andgid
properties don't change if process changes effective user/group id at some point. - 126: Process.ppid(), Process.uids(), Process.gids(), Process.name(), Process.exe(), Process.cmdline() and Process.create_time() properties are no longer cached and correctly raise NoSuchProcess exception if the process disappears.
API changes
psutil.Process.path
property is deprecated and works as an alias forpsutil.Process.exe
property.- Process.kill(): signal argument was removed - to send a signal to the process use Process.send_signal() method instead.
- Process.memory_info() returns a nametuple instead of a tuple.
- cpu_times() returns a nametuple instead of a tuple.
- New Process methods: Process.open_files(), Process.connections(), Process.send_signal() and Process.terminate().
- Process.ppid(), Process.uids(), Process.gids(), Process.name(), Process.exe(), Process.cmdline() and Process.create_time() properties are no longer cached and raise NoSuchProcess exception if process disappears.
- cpu_percent() no longer returns immediately (see issue 123).
- Process.cpu_percent() and cpu_percent() no longer returns immediately by default (see issue 123).
2010-03-02
Enhancements
- 14: Process.username().
- 51, [Linux], [Windows]: per-process current working directory (Process.cwd()).
- 59: Process.is_running() is now 10 times faster.
- 61, [FreeBSD]: added supoprt for FreeBSD 64 bit.
- 71: per-process suspend and resume (Process.suspend() and Process.resume()).
- 75: Python 3 support.
Bug fixes
- 36: Process.cpu_times() and Process.memory_info() functions succeeded. also for dead processes while a NoSuchProcess exception is supposed to be raised.
- 48, [FreeBSD]: incorrect size for MIB array defined in
getcmdargs
. - 49, [FreeBSD]: possible memory leak due to missing
free()
on error condition ingetcmdpath()
. - 50, [BSD]: fixed
getcmdargs()
memory fragmentation. - 55, [Windows]:
test_pid_4
was failing on Windows Vista. - 57: some unit tests were failing on systems where no swap memory is available.
- 58: Process.is_running() is now called before Process.kill() to make sure we are going to kill the correct process.
- 73, [macOS]: virtual memory size reported on includes shared library size.
- 77: NoSuchProcess wasn't raised on Process.create_time() if Process.kill() was used first.
2009-05-06
Enhancements
- 32: Per-process CPU user/kernel times (Process.cpu_times()).
- 33: Per-process create time (Process.create_time()).
- 34: Per-process CPU utilization percentage (Process.cpu_percent()).
- 38: Per-process memory usage (bytes) (Process.memory_info()).
- 41: Per-process memory percent (Process.memory_percent()).
- 39: System uptime (boot_time()).
- 43: Total system virtual memory.
- 46: Total system physical memory.
- 44: Total system used/free virtual and physical memory.
Bug fixes
- 36, [Windows]: NoSuchProcess not raised when accessing timing methods.
- 40, [FreeBSD], [macOS]: fix
test_get_cpu_times
failures. - 42, [Windows]: Process.memory_percent() raises AccessDenied.
2009-03-06
Enhancements
- 4, [FreeBSD]: support for all functions of psutil.
- 9, [macOS], [Windows]: add
Process.uid
andProcess.gid
, returning process UID and GID. - 11: per-process parent object: Process.parent() property returns a Process object representing the parent process, and Process.ppid() returns the parent PID.
- 12, 15: NoSuchProcess exception now raised when creating an object for a nonexistent process, or when retrieving information about a process that has gone away.
- 21, [Windows]: AccessDenied exception created for raising access denied
errors from
OSError
orWindowsError
on individual platforms. - 26: process_iter() function to iterate over processes as Process objects with a generator.
- Process objects can now also be compared with == operator for equality (PID, name, command line are compared).
Bug fixes
- 16, [Windows]: Special case for "System Idle Process" (PID 0) which otherwise would return an "invalid parameter" exception.
- 17: get_process_list() ignores NoSuchProcess and AccessDenied exceptions during building of the list.
- 22, [Windows]: Process.kill() for PID 0 was failing with an unset exception.
- 23, [Linux], [macOS]: create special case for pid_exists() with PID 0.
- 24, [Windows], [critical]: Process.kill() for PID 0 now raises
AccessDenied exception instead of
WindowsError
. - 30: psutil.get_pid_list() was returning two 0 PIDs.