Changelog¶
8.0.0 — unreleased¶
Note
psutil 8.0 introduces breaking API changes. See the migration guide if upgrading from 7.x.
New APIs
#2798, breaking: new
Process.attrsclass attribute, afrozensetof the attribute names accepted byProcess.as_dict()andprocess_iter(). Passingattrs=[]toprocess_iter()to mean “retrieve all attributes” is deprecated. See migration guide.#2776, [Windows], breaking:
virtual_memory()now includescachedandwiredfields.#3052: new
Process.snapshotattribute, a read-onlyProcessSnapshotexposing the attributes collected byprocess_iter()(p.snapshot.nameinstead ofp.info["name"]).Process.infostill works but raisesDeprecationWarning. See migration guide.#1541: new
Process.page_faults()method, returning a(minor, major)named tuple.#2780, [Windows]:
disk_usage()now accepts a file path, not only a directory.#2816, [OpenBSD]:
swap_memory()sinandsoutare no longer set to0.#3023, [FreeBSD], [OpenBSD]:
net_io_counters()dropoutis no longer always0.#2977: new
bytes2human()function, converting bytes to a human-readable string (e.g.9.8K).#1109, [Linux]:
Process.memory_extras()returns a newlockedfield: locked virtual memory (mlock(2)).#1452, #2993, [Linux], [macOS], [Windows]:
Process.memory_footprint()returns a newsharedfield: resident memory shared with other processes.
Reorganization of process memory APIs (#2731, #2736, #2733, #2988).
New
Process.memory_extras()method, returning extra platform-specific memory metrics on Linux, macOS and Windows. See migration guide.New
Process.memory_footprint()method, returninguss,pssandswap(whatProcess.memory_full_info()used to return).breaking:
Process.memory_full_info()is deprecated. Use the newProcess.memory_footprint()instead. See migration guide.breaking:
Process.memory_info()named tuple changed on all platforms: fields were added, removed and renamed. Most old names still work but raiseDeprecationWarning; on macOSpfaultsandpageinswere removed with no backward-compatible aliases, useProcess.page_faults()instead. See migration guide.
Type hints and enums
#2753, breaking: new enum classes (
ProcessStatus,ConnectionStatus,ProcessIOPriority,ProcessPriority,ProcessRlimit) grouping related constants. The top-level constants (e.g.STATUS_RUNNING) remain the primary API, and are now aliases of the enum members. See migration guide.#1946: add inline type hints to all public APIs. mypy still relies on the
types-psutilstubs.#2751: named tuples are now
typing.NamedTupleclasses with type annotations, instead ofcollections.namedtuple().
Other API changes
#2747, breaking: the
cpu_times()field order is now the same on all platforms, starting withuser,system,idle. See migration guide.#2772, [Windows], breaking:
cpu_times()interruptfield renamed toirq, as on Linux and BSD.interruptstill works but raisesDeprecationWarning.#2889, [Windows], breaking: 32-bit psutil can no longer inspect 64-bit processes:
Process.cwd()raisesAccessDenied(Process.cmdline()andProcess.environ()are unaffected). 32-bit wheels were already dropped in 7.1.2 (#2657).#2992:
Process.memory_percent()is now rounded to 2 decimal places, like the other*_percentAPIs.#2754:
sensors_battery()percentis now afloaton all systems, not only Linux.#2799:
Process.as_dict()now returns a dict with keys sorted alphabetically when attrs is not specified.#2805, [BSD]: on NetBSD,
cpu_stats()andvirtual_memory()no longer depend onprocfs.#2947: psutil now emits a
RuntimeWarningwhen it returns incomplete or approximated results (e.g. a failed sanity check on kernel data). Before, these were only visible withPSUTIL_DEBUG.
Dropped support
#2872, breaking: Python 3.6 and 3.7 (minimum is now 3.8).
#2893, [Windows], breaking: Windows Vista, 7, 8, 8.1 and their server counterparts (minimum is now Windows 10 / Server 2016).
#2936, [Windows], breaking: PyPy older than 7.3.14.
#2987, [macOS], breaking: macOS 10.7 and 10.8 (minimum is now 10.9).
Performance
#2695, [Windows]:
net_io_counters()is ~5x faster.net_if_stats()andnet_if_addrs()also got faster.#2919, #2920, [Windows]:
Process.threads()is around 25x faster,Process.ppid()andProcess.children()around 3.5x.Process.threads()also no longer silently misses the threads which could not be opened due toAccessDenied.#2922, [Windows]:
Process.ppid()is around 58x faster (99x on ARM64).#2923, [Windows]:
Process.status()is now part of theProcess.oneshot()group. Reading 4 methods of that group in oneProcess.oneshot()block is now around 3.9x faster than without it, up from 2x.#2932, [Windows]:
Process.open_files()is 140x to 400x faster (from 235 ms to 0.39 ms per call).#2939: syscalls which can block (disk devices, mount points, NIC drivers, etc) now release the GIL, so a slow psutil call no longer freezes the other threads.
Build and packaging
#2788, breaking: git tags renamed from
release-X.Y.ZtovX.Y.Z(old tags are kept). See migration guide.#2914, [macOS], breaking: Intel wheels now require macOS 10.15 or higher, up from 10.9.
arm64wheels are unaffected.#2915, breaking: stop publishing wheels for free-threaded CPython 3.13 (
cp313t), which was experimental. Onlycp314twheels are published.#2976, [Linux]: publish ppc64le and s390x wheels.
#2576: the C extension modules now use PEP 489 multi-phase initialization.
#2844: removed docs/ from the tarball (from 586K to 396K).
#2883: the platform-specific C extension modules are now built as a single private
_psutilmodule.#2909:
setup.pyno longer usesdistutils(removed in Python 3.12).#2925: the C sources are now compiled in parallel, making builds 2x to 3.6x faster. This mostly helps platforms with no wheels (*BSD, Solaris, AIX). Use
PSUTIL_BUILD_JOBSto cap the number of jobs.
Documentation
#2757, #2760: split docs from a single HTML file into multiple new sections: /about, /adoption (#2763), /alternatives (#2775), /api-overview, /credits (#2764), /faq (#2769), /funding (#2797), /genindex (#2808), /glossary (#2774), /install, /migration (#2771), /performance (#2787), /platform, /recipes (#2761), /shell-equivalents (#2768), /stdlib-equivalents (#2781).
Blog: new blog at /blog (#2825), with 20 posts imported from https://gmpy.dev, with comments via giscus.
Theming: renewed theme with a top bar (#2819), dark theme (#2803,
Shift+D), Monokai code snippets.Usability: right TOC sidebar (#2828), COPY button on code snippets (#2761), “copy page” button copying the page’s RsT source (#2981), “back to top” button. Identifiers in code blocks (e.g.
psutil.Process(),p.cpu_percent()) are clickable (#2826). Improved prose / clarity (#2745, #2801). Keyboard shortcuts (#2820).Go to API definition by pressing
@(#2995).Testing:
rstcheckwas replaced bysphinx-lint+ detect dead ref links (#2767). Python code snippets are syntax-checked at build time (#2761).Hosting: moved from Read the Docs to GitHub Pages at https://psutil.io, with no
/enURL prefix (#2790). Deployed on every push tomaster(#2739). Past releases are served too, e.g. https://psutil.io/7.2/ (#2980).Misc: doc is built in CI (fails on error),
.rstfiles are wrapped via https://github.com/giampaolo/rstwrap (#2823), added/sitemap.xml. New 404 page (#2829).
Internals
#2765: add a PR bot that uses Claude to update
changelog.rstandcredits.rstwhen commenting with /changelog.#2927: Python dependencies are now installed with
uvwhen available, saving ~10 secs per CI run.#3066: the C extension is now compiled with
-Wall -Wextra(/W4on Windows), with warnings as errors in CI.
Bug fixes: cross-platform
#2857, [Linux], [SunOS], memleak:
disk_partitions()(Linux) andProcess.environ()(SunOS) leaked a reference when argument parsing failed. On SunOSProcess.environ()also checked the wrong variable for NULL.#2793:
process_iter()silently skipped zombie processes.#2830, [Linux], [macOS], [BSD]:
Process.terminal()returnedNonefor terminals opened after the first call (e.g. a new/dev/pts/N).#2895:
Processmethods could wrongly raiseNoSuchProcess(“PID has been reused”) when the process creation time could not be determined (e.g. zombies on NetBSD / OpenBSD,AccessDeniedon Windows).#2899: two
Processinstances for the same process could compare unequal if the creation time could not be determined.hash(Process)is now based on the PID alone.
Bug fixes: Linux
#2860, #2966, critical:
Process.cpu_affinity()could segfault under memory pressure, and on Python <= 3.11 it corrupted CPython’s small integer cache.#2628:
cpu_freq()counted offline CPUs, reported with all-zero frequencies, which dragged down the averages.#2715:
Process.wait()could fail withEINVALdue to a kernel race condition.#2732:
net_if_stats()didn’t handleEBUSYfromioctl(SIOCETHTOOL).#2770:
cpu_count()(logical=False) raisedValueErroron s390x.#2809:
swap_memory()andvirtual_memory()raisedValueErroron arm64 when a/proc/meminfofield had no space after the colon (e.g.ShadowCallStack:10373888 kB).#2871: on Python 3.15+
Process.rlimit()returnedRLIM_INFINITYas2**64-1instead of-1.#2967:
cpu_freq()returnedNoneon ppc machines without cpufreq sysfs, and reported twice as many CPUs on s390x.#2512:
cpu_freq()withpercpu=Truereturned one entry per cpufreq policy instead of one per CPU (fewer entries thancpu_count()on POWER9, Apple M1, RISC-V).#2611: re-enable Android support, broken on Python 3.13.
disk_partitions()no longer raisesPermissionErrorthere.#3082:
Process.cmdline()andProcess.environ()turned\rand\r\ninto\ninside arguments and environment variable values.
Bug fixes: Windows
#1967, critical:
Process.open_files()could deadlock the calling process when a handle name query timed out.#2859, critical:
net_connections()/Process.net_connections()could crash when argument parsing failed.#2847, critical:
cpu_stats()read the context switches and syscalls counts from a buffer it had just freed.#2934, critical:
Process.memory_maps()could crash with a stack buffer overflow on mapped file paths longer than 260 characters. Such paths are also no longer truncated.#2937, critical:
disk_io_counters()could let a disk driver write past the end of a stack buffer.#2943, critical:
win_service_iter()could crash the interpreter if the service enumeration failed.#2946, critical:
heap_info()could read uninitialized memory and return bogus values if the number of process heaps changed mid-call.#2972, critical: on systems with more than 64 CPUs,
cpu_times()(percpu=True) andcpu_stats()read uninitialized memory.#2932, memleak:
Process.open_files()leaked a thread and a handle for every name query which timed out, and could hang for ~1 minute on files open on an unreachable network share.#2935, memleak:
Process.kill()andProcess.terminate()leaked a process handle whenTerminateProcess()failed with an error other thanERROR_ACCESS_DENIED.#1007:
boot_time()fluctuated by ~1 second across calls and processes.#1959:
disk_partitions()could raiseUnicodeDecodeErroron non-UTF-8 ANSI code pages (e.g. cp1251).#2383:
WindowsService.description()(andWindowsService.as_dict()) could fail withERROR_FILE_NOT_FOUNDwhen the description points to a missing resource (e.g.WaaSMedicSvc). It now returns an empty string.#2655:
net_if_stats()returned4294967295as the speed of NICs faster than ~4.29 Gbps (32-bit overflow).#2711, #2940:
net_if_addrs()returnedNoneforbroadcast, and could report an IPv4netmaskfor an IPv6 address.#2875:
sensors_battery()returned4294967295instead ofPOWER_TIME_UNKNOWNwhen the remaining time was unknown.#2938:
disk_partitions()optslacked the drive type (fixed,cdrom, …) for volume mount points.#2941:
net_io_counters()raisedRuntimeErrorif a NIC was disabled or unplugged mid-call. Now it’s skipped.#3016:
Process.send_signal()withCTRL_C_EVENTorCTRL_BREAK_EVENTon PID 0 delivered the event to every process on the caller’s console, the caller included. It now raisesAccessDenied.#3019:
Process.memory_maps()truncatedrssfor regions of 4 GiB or larger.#3022:
Process.wait()returned exit codes with the high bit set (e.g.0xC0000005) as negative numbers.
Bug fixes: macOS
#2885, critical:
Process.memory_full_info(),Process.memory_footprint()andProcess.threads()could hang forever on headless VMs (e.g. CI runners). They also raiseAccessDeniedless often.#2382:
cpu_freq()was undefined (or raisedRuntimeError) on virtualized ARM64 (e.g. CI runners). It now returnsNonewhen the frequency can’t be determined.#2411:
Process.cpu_times()andProcess.cpu_percent()were ~41x too low on x86_64.#2642:
cpu_freq()returned values ~1000x too small on Apple M4+, and failed on M5.#2726:
Process.num_ctx_switches()returned an unusually high number.#2841:
cpu_freq()could raiseSystemErrorwhen frequency data is missing (e.g. Apple M5). It now returnsNone.#2853:
virtual_memory()andswap_memory()could raiseRuntimeError((ipc/mig) array not large enough) on newer macOS versions.#2854:
Process.cmdline()andProcess.environ()could raiseSystemErrorinstead ofAccessDenied.
Bug fixes: BSD
#2744, [NetBSD], critical: fix possible double
free()inswap_memory().#2848, critical:
net_io_counters()could overflow a stack buffer on unusually long interface names.#3071, [OpenBSD], critical:
users()crashed if/var/run/utmpcould not be opened.#3073, [NetBSD], critical:
net_connections()andProcess.net_connections()read freed memory.#1534, [NetBSD]:
Process.exe()is now read viasysctl()instead of the/proc/pid/exesymlink.#1801, [FreeBSD]:
cpu_freq()could raiseUnicodeDecodeErroron non-UTF-8dev.cpu.N.freq_levelsdata.#2746, [FreeBSD]:
Process.memory_maps()rssandprivatewere in pages instead of bytes.#2782, [FreeBSD]:
cpu_count()(logical=False) returnedNoneon systems without hyper-threading.#2791, [FreeBSD]:
sysctl()calls failed if the kernel returned fewer bytes than the buffer size (normal for variable-length data).#2795, [FreeBSD]:
cpu_freq()could raiseRuntimeError(size mismatch) on some systems.#2811, #2813, [OpenBSD]:
virtual_memory()sharedwas in pages instead of bytes, and overvalued.bufferswas always 0; it now equalscached.#2814, #2815, [NetBSD]:
virtual_memory()cached(included anonymous pages) andsharedwere overvalued.#2822:
Process.cmdline()on NetBSD could raiseOSError: [Errno 14] Bad addressinstead ofNoSuchProcessfor an exiting process.#2888, [FreeBSD], [OpenBSD]:
Processmethods could wrongly raiseNoSuchProcess(“PID has been reused”) after a system clock update (e.g. NTP). The PID reuse check is now disabled there (and on SunOS and AIX).#2902, [NetBSD], [OpenBSD]:
Process.cmdline()could raiseOSError(EINVAL)(OpenBSD) or a brokenNoSuchProcess(NetBSD) for a process which died mid-call.#2903:
Process.nice()could raiseNoSuchProcessfor processes inSIDLstate (not fully initialized).#2905, [FreeBSD], [OpenBSD], [NetBSD]:
Process.gids()savedreported the saved user ID instead of the group ID (since 2011).#2907, [NetBSD]: exiting processes (not yet zombies) weren’t recognized:
Processmethods raisedNoSuchProcessinstead ofZombieProcess, andProcess.status()returned"sleeping"or"?".STATUS_SUSPENDEDwas never returned.Process.environ()raisedOSErrorfor exiting or zombie processes.#2929, [NetBSD], [OpenBSD]:
Process.num_fds()returned a wrong, system-wide number, andProcess.open_files()always returned an empty list.#2951, [OpenBSD]:
cpu_times()returned times averaged across CPUs instead of summed.#2952, [OpenBSD]:
Process.environ()raisedOSError(EINVAL)for an exiting process. For a zombie it now raisesZombieProcesson all BSDs.#3016, [NetBSD]:
Process.num_fds()andProcess.open_files()for PID 0 returned the file descriptors of every process on the system.#3020, [FreeBSD]:
Process.memory_maps()now brackets non-file mapping names, e.g.[sys:vm_anon]instead ofsys:vm_anon.#3013:
net_io_counters()returned garbage on 32-bit builds.#3032, [FreeBSD]:
cpu_stats()counters wrapped around at 2^32.#3017, [FreeBSD]:
pid_exists()returnedFalsefor PID 0 (the kernel), even thoughpids()lists it.#3072, [OpenBSD]:
users()could return trailing garbage inname,terminalorhost.
Bug fixes: POSIX
#2877, critical: fix a one-byte stack buffer overflow in
users()whenut_hostfilled the whole field.#3070, critical:
net_if_addrs()freed an uninitialized pointer ifgetifaddrs()failed.#3075, [SunOS], critical:
Process.memory_maps()could read past the end of a heap buffer if reading/proc/[pid]/xmapfailed.#2789, [AIX], build-fail: compilation failed because of a typo.
#2858, [SunOS], memleak:
disk_io_counters()leaked the result dict whenkstat_read()failed.#3074, [SunOS]:
Process.terminal()returned the path of file descriptor 0 instead ofNonefor processes without a controlling terminal.#3076, [SunOS]:
Process.cmdline()andProcess.environ()could raiseSystemErrorinstead ofNoSuchProcessif the process exited mid-read.#2778:
net_if_addrs()skipped interfaces with no addresses (e.g. tunnels), unlikenet_io_counters()andnet_if_stats(). They are now included, withfamilyset tosocket.AF_UNSPEC.#2964:
net_if_addrs()returned the interface’s own address asbroadcastfor/32IPv4 addresses. It now returnsNone.#2953, [SunOS]:
Process.gids()returned apuidsnamed tuple,Process.nice()was off by +20, andProcess.net_connections()returned UNIX sockets withtype=-1/fd=-1and raisedRuntimeErrorfor zombies.#3015:
Process.nice()on PID 0 changed the niceness of the calling process (on macOS and AIX the getter returned the caller’s). It now raisesAccessDenied.#3017:
OSErrormessages could raiseUnicodeDecodeErrorin non-UTF-8 locales.#3018, [SunOS], [AIX]:
boot_time(), andcpu_times()per-CPU values on SunOS, lost precision.#3013, [AIX]:
Process.uids()andProcess.gids()returned garbage on 32-bit builds.#3013, [SunOS]:
Process.uids()andProcess.gids()returned negative numbers for ephemeral ids (>= 2**31, e.g. SMB and NFSv4 identities).
7.2.2 — 2026-01-28¶
Performance
#2705, [Linux], [macOS], [BSD]:
Process.wait()no longer uses a busy loop. It now usespidfd_open()+poll()on Linux (requires Linux >= 5.3 and Python >= 3.9), andkqueue()on macOS and BSD.
Bug fixes
#2701, [macOS], build-fail: fix compilation error on macOS < 10.7.
#2707, [macOS], memleak: fix potential memory leaks in error paths of
Process.memory_full_info()andProcess.threads().#2708, [macOS]:
Process.cmdline()andProcess.environ()may fail withOSError: [Errno 0] Undefined error(fromsysctl(KERN_PROCARGS2)). They now raiseAccessDeniedinstead.
7.2.1 — 2025-12-29¶
Bug fixes
#2699, [FreeBSD], [NetBSD]:
heap_info()does not detect small allocations (<= 1K). In order to fix that, we now flush internal jemalloc cache before fetching the metrics.
7.2.0 — 2025-12-23¶
New APIs
#1275: new
heap_info()andheap_trim()functions, providing direct access to the platform’s native C heap allocator (glibc, mimalloc, libmalloc). Useful to create tools to detect memory leaks.
Build and packaging
#2680, breaking: unit tests are no longer installed / part of the distribution. They now live under
tests/instead ofpsutil/tests, soimport psutil.testsno longer works (it was never documented to begin with).#2403, [Linux]: publish wheels for Linux musl.
Bug fixes
#2684, [FreeBSD], build-fail: compilation fails on FreeBSD 14 due to missing include.
#2691, [Windows], memleak: fix memory leak in
net_if_stats()due to missingPy_CLEAR.
7.1.3 — 2025-11-02¶
Internals
#2667: enforce
clang-formaton all C and header files. It is now the mandatory formatting style for all C sources.#2676, #2678: replace unsafe
sprintf/snprintf/sprintf_swithstr_format, andstrlcat/strlcpywithstr_copy/str_append. Unifies string handling across platforms.
Bug fixes
#2677, [Windows], critical: fix MAC address string construction in
net_if_addrs()(buffer overflow / misformat risk).#2679, [OpenBSD], [NetBSD], build-fail: can’t build due to C syntax error.
#2672, [macOS], [BSD]: increase the chances to recognize zombie processes and raise the appropriate exception (
ZombieProcess).#2674, [Windows]:
disk_usage()could truncate values on 32-bit platforms, potentially reporting incorrecttotal,free,usedspace for drives larger than 4GB.#2675, [macOS]:
Process.status()incorrectly returnsSTATUS_RUNNINGfor 99% of the processes.
7.1.2 — 2025-10-25¶
Build and packaging
#2657, breaking: stop publishing prebuilt Linux and Windows wheels for 32-bit Python. 32-bit CPython is still supported, but psutil must now be built from source.
#2565: produce wheels for free-threaded CPython 3.13 and 3.14.
Bug fixes
#2658, [macOS], critical: double
free()inProcess.environ()when it fails internally. This posed a risk of segfault.#2662, [macOS], critical: massive C code cleanup to guard against possible segfaults which were (not so) sporadically spotted on CI.
#2650, [macOS]:
Process.cmdline()andProcess.environ()may incorrectly raiseNoSuchProcessinstead ofZombieProcess.
7.1.1 — 2025-10-19¶
Dropped support
#2645, [SunOS], breaking: SunOS 10.
Internals
#2646, [SunOS]: add CI test runner for SunOS.
Bug fixes
#2641, [SunOS], build-fail: cannot compile psutil from sources due to missing C include.
#2357, [SunOS]:
Process.cmdline()does not handle spaces properly.
7.1.0 — 2025-09-17¶
Dropped support
#2571, [FreeBSD], breaking: FreeBSD 8 and earlier. FreeBSD 8 was maintained from 2009 to 2013.
Build and packaging
#2581, [Windows]: publish ARM64 wheels.
Internals
#2575: introduced
dprintCLI tool to format .yml and .md files.
Bug fixes
#2545, [SunOS], critical: fix handling of
MIB2_UDP_ENTRYinnet_connections().#2586, [macOS], critical: fixed different places in C code which can trigger a segfault.
#2610, [macOS], critical: fix
cpu_freq()segfault on ARM architectures.#2473, [macOS], build-fail: fix build issue on macOS 11 and lower.
#2494, [Windows]:
Process.memory_maps(),Process.exe()andProcess.open_files()now properly handle UNC paths (e.g.\\??\\C:\\Windows\\Temp→C:\\Windows\\Temp).#2506, [Windows]: Windows service APIs had issues with unicode services using special characters in their name.
#2514, [Linux]:
Process.cwd()sometimes fails withFileNotFoundErrordue to a race condition.#2526, [Linux]:
Process.create_time()now uses a monotonic clock, preventingProcess.is_running()from returning wrong results after system clock updates.#2528, [Linux]:
Process.children()may raisePermissionError. It will now raiseAccessDeniedinstead.#2540, [macOS]:
boot_time()is off by 45 seconds (C precision issue).#2541, #2570, #2578, [Linux], [macOS], [NetBSD]:
Process.create_time()does not reflect system clock updates.#2542: if system clock is updated
Process.children()andProcess.parent()may not be able to return the right information.#2552, [Windows]:
boot_time()didn’t take into account the time spent during suspend / hibernation.#2560, [Linux]:
Process.memory_maps()may crash withIndexErroron RISCV64 due to a malformed/proc/pid/smapsfile.#2604, [Linux]:
virtual_memory()usedfield does not match recent versions offreeCLI utility.#2605, [Linux]:
sensors_battery()reports a negative amount for seconds left.#2607, [Windows]:
WindowsService.description()method may fail withERROR_NOT_FOUND. Now it returns an empty string instead.
7.0.0 — 2025-02-13¶
New APIs
#669, [Windows]:
net_if_addrs()also returns thebroadcastaddress instead ofNone.
API changes
#2490, breaking: remove long deprecated
Process.memory_info_ex()(deprecated since 4.0.0). UseProcess.memory_full_info()instead.
Dropped support
#2480, breaking: Python 2.7. Latest version supporting it is psutil 6.1.X (
pip2 install psutil==6.1.*).
Bug fixes
#2496, [Linux], critical: avoid segfault (a CPython bug) on
Process.memory_maps()for processes that use hundreds of GBs of memory.#2502, [macOS]:
virtual_memory()now useshost_statistics64(same asvm_stat), more accurate.
6.1.1 — 2024-12-19¶
Internals
#2471: use Vulture CLI tool to detect dead code.
Bug fixes
#2418, [Linux]: fix race condition in case
/proc/pid/statdoes not exist, but/proc/piddoes, resulting inFileNotFoundError.#2470, [Linux]:
users()may return “localhost” instead of the actual IP address of the user logged in.
6.1.0 — 2024-10-17¶
Performance
#2366, [Windows]: drastically speedup
process_iter()by using process “fast” create time to determine process identity.#2457, [AIX]: significantly improve the speed of
Process.open_files()for some edge cases.
Internals
#2446: use pytest instead of unittest.
#2448: add
make install-sysdepstarget to install the necessary system dependencies (python-dev, gcc, etc.) on all supported UNIX flavors.#2449: add
make install-pydeps-testandmake install-pydeps-devtargets. 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 running tests via
python3 -m psutil.testseven ifpytestis not installed.
Bug fixes
#2427, critical: psutil (segfault) on import in the free-threaded (no GIL) version of Python 3.13.
#2455, [Linux]:
IndexErrormay occur when reading/proc/pid/statand field 40 (blkio_ticks) is missing.#2460, [OpenBSD]:
Process.num_fds()andProcess.open_files()may fail withNoSuchProcessfor PID 0. Instead, we now return “null” values (0and[]respectively).
6.0.0 — 2024-06-18¶
New APIs
#2396: a new
process_iter.cache_clear()API can be used to clearprocess_iter()internal cache.
API changes
#2109, breaking: the named tuple returned by
disk_partitions()no longer has themaxfileandmaxpathfields (they can be very slow to retrieve on NFS).#2407, breaking: rename
Process.connections()toProcess.net_connections(). Old name still works but is deprecated.
Performance
#2396, breaking:
process_iter()no longer preemptively checks whether PIDs have been reused, making it around 20x faster. UseProcess.is_running()on yielded instances instead (it also removes reused PIDs from the internal cache).
Build and packaging
#2369, [Windows], build-fail: wheels failed to build. Fixed by upgrading
cibuildwheel.#2375, [macOS]: provide arm64 wheels.
#2401: support building with free-threaded CPython 3.13.
#2425, [Linux]: provide aarch64 wheels.
Internals
#2366, [Windows]: log debug message when using slower process APIs.
Bug fixes
#2360, [macOS], build-fail: can’t compile on macOS < 10.13.
#2362, [macOS], build-fail: can’t compile on macOS 10.11.
#2365, [macOS], build-fail: can’t compile on macOS < 10.9.
#2412, [macOS], build-fail: can’t compile on macOS 10.4 PowerPC due to missing
MNT_constants.#2250, [NetBSD]:
Process.cmdline()sometimes fails withEBUSYfor long cmdlines. Now retries up to 50 times, returning an empty list as last resort.#2254, [Linux]: offline CPUs raise
NotImplementedErrorincpu_freq().#2272: add pickle support to psutil exceptions.
#2359, [Windows]:
pid_exists()disagrees withProcesson whether a pid exists whenERROR_ACCESS_DENIED.#2395, [OpenBSD]:
pid_exists()erroneously returnsTrueif the argument is a thread ID (TID) instead of a PID (process ID).
5.9.8 — 2024-01-19¶
Performance
#2343, [FreeBSD]: filter
net_connections()in C instead of Python, ~4x faster. Only requested connection types are now retrieved.
Internals
#2349: adopted black formatting style.
Bug fixes
#930, [NetBSD], critical, memleak:
net_connections()implementation was broken. It could either leak memory or core dump.#2345, [Linux], build-fail: fix compilation on older compiler missing
NIC_DUPLEX_UNKNOWN.#2340, [NetBSD]: if process is terminated,
Process.cwd()will return an empty string instead of raisingNoSuchProcess.#2222, [macOS]:
cpu_freq()now returns fixed values forminandmaxfrequencies in all Apple Silicon chips.
5.9.7 — 2023-12-17¶
Internals
#2324: enforce Ruff rule
raw-string-in-exception, which helps provide clearer tracebacks when exceptions are raised by psutil.
Bug fixes
5.9.6 — 2023-10-15¶
API changes
#1703:
cpu_percent()andcpu_times_percent()are now thread safe.#2266: if
Processclass is passed a very high PID, raiseNoSuchProcessinstead ofOverflowError.#2290: PID reuse is now preemptively checked for
Process.ppid()andProcess.parents().
Dropped support
#2246, breaking: Python 3.4 and 3.5.
Internals
#2312: use
rufflinter instead offlake8 + isort.
Bug fixes
#2241, [NetBSD], build-fail: can’t compile on NetBSD 10.99.3/amd64.
#2195, [Linux]: no longer print exception at import time in case
/proc/statcan’t be read due to permission error. Redirect it toPSUTIL_DEBUGinstead.#2245, [Windows]: fix possibly unbound variable error in
swap_memory().#2268:
bytes2human()utility function was unable to properly represent negative values.#2252, [Windows]:
disk_usage()fails on Python 3.12+.#2284, [Linux]:
Process.memory_full_info()may incorrectly raiseZombieProcessif it’s determined via/proc/pid/smaps_rollup. Instead we now fallback on reading/proc/pid/smaps.#2287, [OpenBSD], [NetBSD]:
Process.is_running()erroneously returnsFalsefor zombie processes, because creation time cannot be determined.#2288, [Linux]: correctly raise
ZombieProcessonProcess.exe(),Process.cmdline()andProcess.memory_maps()instead of returning a “null” value.#2290: contrary to what the doc stated, PID reuse is not preemptively checked for
Process.nice()(set),Process.ionice()(set),Process.cpu_affinity()(set),Process.rlimit()(set),Process.parent().#2308, [OpenBSD]:
Process.threads()always fails withAccessDenied(also as root).
5.9.5 — 2023-04-17¶
API changes
#2230, [OpenBSD]:
net_connections()rewritten from scratch: now retrievessocket.AF_UNIXsocket paths, is faster, and no longer produces duplicates.#2238:
Process.cwd()now consistently returns""on all platforms when the directory can’t be determined.#2239, [POSIX]: for zombie processes, return the truncated
Process.name()(15 chars) instead of raisingZombieProcesswhen the full name can’t be determined fromProcess.cmdline().
Internals
#2196: in case of exception, display a cleaner error traceback by hiding the
KeyErrorbit deriving from a missed cache hit.#2217: print the full traceback when a
DeprecationWarningorUserWarningis raised.#2240, [NetBSD], [OpenBSD]: add CI testing on every commit for NetBSD and OpenBSD platforms (Python 3 only).
Bug fixes
#2164, [Linux], build-fail: compilation fails on kernels < 2.6.27 (e.g. CentOS 5).
#2186, [FreeBSD], build-fail: compilation fails with Clang 15.
#1043, [OpenBSD]:
net_connections()returns duplicate entries.#1915, [Linux]: on certain kernels,
"MemAvailable"field from/proc/meminforeturns0(possibly a kernel bug), in which case we calculate an approximation foravailablememory which matches “free” CLI utility.#2191, [Linux]:
disk_partitions(): do not unnecessarily read/proc/filesystemsand raiseAccessDeniedunless user specifiedall=Falseargument.#2216, [Windows]: fix tests when running in a virtual environment.
#2225, [POSIX]:
users()loses precision forstartedfield (off by 1 minute).#2229, [OpenBSD]: unable to properly recognize zombie processes.
NoSuchProcessmay be raised instead ofZombieProcess.#2231, [NetBSD]:
availablevirtual_memory()is higher thantotal.#2234, [NetBSD]:
virtual_memory()metrics are wrong:availableandusedare too high. We now match values shown by htop CLI utility.#2236, [NetBSD]:
Process.num_threads()andProcess.threads()return threads that are already terminated.#2237, [OpenBSD], [NetBSD]:
Process.cwd()may raiseFileNotFoundErrorif cwd no longer exists. Return an empty string instead.
5.9.4 — 2022-11-07¶
Build and packaging
#2102: use Limited API when building wheels with CPython 3.6+ on Linux, macOS and Windows.
Bug fixes
#2156, [Linux], build-fail: compilation may fail on very old gcc compilers due to missing
SPEED_UNKNOWNdefinition.#2010, [macOS], build-fail: on macOS, arm64
IFM_1000_TXandIFM_1000_Tare the same value, causing a build failure.#2077, [Windows]: use system-level values for
virtual_memory().#2160, [Windows]: get
swap_memory()percentusage from performance counters.
5.9.3 — 2022-10-18¶
Build and packaging
#2040, [macOS]: provide wheels for arm64 architecture.
Internals
#2153, [macOS]: fix race condition in
test_posix.TestProcess.test_cmdline.
Bug fixes
#2135, [macOS], critical:
Process.environ()may contain garbage data. Fix out-of-bounds read aroundsysctl_procargs.#2138, [Linux], build-fail: can’t compile psutil on Android due to undefined
ethtool_cmd_speedsymbol.#2116, [macOS]:
net_connections()fails withRuntimeError.#2142, [POSIX]:
net_if_stats()flagson Python 2 returned unicode instead of str.#2147, [macOS]: fix disk usage report on macOS 12+.
#2150, [Linux]:
Process.threads()may raiseNoSuchProcess. Fix race condition.
5.9.2 — 2022-09-04¶
Bug fixes
#2093, [FreeBSD]:
pids()may fail with ENOMEM. Dynamically increase themalloc()buffer size until it’s big enough.#2095, [Linux]:
net_if_stats()returns incorrect interface speed for 100GbE network cards.#2113, [FreeBSD]:
virtual_memory()may raise ENOMEM due to missing#include <sys/param.h>directive.#2128, [NetBSD]:
swap_memory()was miscalculated.
5.9.1 — 2022-05-20¶
New APIs
#2037: add
flagsfield tonet_if_stats().#2057, [OpenBSD]: add support for
cpu_freq().
Dropped support
#1053, breaking: Python 2.6 (minimum is now 2.7).
Performance
#2107, [Linux]:
Process.memory_full_info()now reads/proc/pid/smaps_rollupinstead of/proc/pid/smaps(5x faster).
Bug fixes
#2048:
AttributeErroris raised ifpsutil.Errorclass is raised manually and passed throughstr.#2049, [Linux]:
cpu_freq()erroneously returnscurrentvalue in GHz whileminandmaxare in MHz.#2050, [Linux]:
virtual_memory()may raiseValueErrorif running in an LXC container. Fixed by increasing the read(2) buffer size from 1k to 32k when reading/procpseudo files line by line.
5.9.0 — 2021-12-29¶
New platforms
#1996, [BSD]: MidnightBSD.
API changes
#1992:
NoSuchProcessmessage now specifies if the PID has been reused. Error classes now have improved__repr__and__str__.#1999, [Linux]:
disk_partitions(): convert/dev/rootdevice (an alias used on some Linux distros) to real root device path.
Performance
#1851, [Linux]:
cpu_freq()reads from/proc/cpuinfoinstead of many files in/sysfs, faster on systems with many CPUs.
Documentation
#2042: rewrite HISTORY.rst to use hyperlinks pointing to psutil API doc.
Internals
#2005:
PSUTIL_DEBUGmode now prints file name and line number of the debug messages coming from C extension modules.
Bug fixes
#1953, [Windows], critical:
disk_partitions()crashes due to insufficient buffer len.#1965, [Windows], critical: fix “Fatal Python error: deallocating None” when calling
users()multiple times.#1990, [Windows], memleak: starting a
WindowsServiceleaked a service handle.#1512, [macOS]: sometimes
Process.connections()will crash withEOPNOTSUPPfor one connection; this is now ignored.#1598, [Windows]:
disk_partitions()only returns mount points on drives where it first finds one.#1874, [SunOS]: swap output error due to incorrect range.
#1892, [macOS]:
cpu_freq()broken on Apple M1. Also,minandmaxare set to 0 if they can’t be determined, instead of raising an exception.#1901, [macOS]:
Process.open_files(),Process.connections()and others could randomly raiseAccessDeniedbecause the internal buffer ofproc_pidinfo(PROC_PIDLISTFDS)was too small. Now dynamically increased until sufficient.#1904, [Windows]:
OpenProcessfails withERROR_SUCCESSdue toGetLastError()called aftersprintf().#1913, [Linux]:
wait_procs()should catchsubprocess.TimeoutExpiredexception.#1919, [Linux]:
sensors_battery()can raiseTypeErroron PureOS.#1921, [Windows]:
swap_memory()shows committed memory instead of swap.#1940, [Linux]: psutil does not handle
ENAMETOOLONGwhen accessing process file descriptors in procfs.#1948:
memoize_when_activateddecorator is not thread-safe.#1980, [Windows]: 32bit / WoW64 processes fail to read
Process.name()longer than 128 characters.#1991:
process_iter()is not thread safe and can raiseTypeErrorif invoked from multiple threads.#1956, [macOS]:
Process.cpu_times()reports incorrect timings on M1 machines.#2023, [Linux]:
cpu_freq()return order is wrong on systems with more than 9 CPUs.
5.8.0 — 2020-12-19¶
New platforms
#1872, [Windows]: PyPy 2.7.
New APIs
#1863:
disk_partitions()exposes 2 extra fields:maxfileandmaxpath, which are the maximum file name and path name length.
Build and packaging
#1879: provide pre-compiled wheels for Linux and macOS (yay!).
Internals
#1880: switch CI from Travis/Cirrus to GitHub Actions (Linux, macOS, FreeBSD). AppVeyor still used for Windows.
Bug fixes
#1708, [Linux]: get rid of
sensors_temperatures()duplicates.#1839, [Windows]: always raise
AccessDeniedinstead ofWindowsErrorwhen failing to query 64 processes from 32 bit ones by usingNtWoW64APIs.#1866, [Windows]:
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]:
Process.username()may raiseERROR_NONE_MAPPEDif the SID has no corresponding account name. In this caseAccessDeniedis now raised.#1886, [macOS]:
EIOerror may be raised onProcess.cmdline()andProcess.environ(). Now it gets translated intoAccessDenied.#1887, [Windows]:
OpenProcessmay fail with “[WinError 0] The operation completed successfully”. Turn it intoAccessDeniedorNoSuchProcessdepending on whether the PID is alive.#1891, [macOS]: get rid of deprecated
getpagesize().
5.7.3 — 2020-10-24¶
New APIs
#809, [FreeBSD]: add support for
Process.rlimit().#893, [BSD]: add support for
Process.environ().
API changes
#1830, [POSIX]:
net_if_stats()isupalso checks whether the NIC is running (meaning Wi-Fi or ethernet cable is connected).#1837, [Linux]: improved battery detection and charge
secsleftcalculation.
Bug fixes
#1823, [Windows], critical:
Process.open_files()may cause a segfault due to a NULL pointer.#1791, [macOS], build-fail: fix missing include for
getpagesize().#1620, [Linux]:
cpu_count()withlogical=Falseresult is incorrect on systems with more than one CPU socket.#1738, [macOS]:
Process.exe()may raiseFileNotFoundErrorif process is still alive but the exe file which launched it got deleted.#1838, [Linux]:
sensors_battery(): ifpercentcan be determined but not the remaining values, still return a result instead ofNone.
5.7.2 — 2020-07-15¶
Bug fixes
wheels for 2.7 were inadvertently deleted.
5.7.1 — 2020-07-15¶
New platforms
#1768, [Windows]: Windows Nano Server.
API changes
#1747:
Process.wait()return value is cached so that the exit code can be retrieved on the 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:
Processclass provides more info about the process onstr()andrepr()(status and exit code).
Performance
#1741, [POSIX]:
make buildnow runs in parallel on Python >= 3.6 and it’s about 15% faster.
Internals
#1709: parallel tests on POSIX (
make test-parallel). They’re twice as fast!#1757: memory leak tests are now stable.
Bug fixes
#1781, critical:
getloadavg()can crash the Python interpreter.#1726, [Linux]:
cpu_freq()parsing should use spaces instead of tabs on ia64.#1760, [Linux]:
Process.rlimit()does not handle long long type properly.#1766, [macOS]:
NoSuchProcessmay be raised instead ofZombieProcess.
5.7.0 — 2020-02-18¶
New platforms
API changes
#1648, [Linux]:
sensors_temperatures()looks into an additional/sys/device/directory for additional data.#1677, [Windows]:
Process.exe()will succeed for all process PIDs (instead of raisingAccessDenied).#1693, [Windows]:
boot_time(),Process.create_time()andusers()’s login time now have 1 micro second precision (before the precision was of 1 second).
Dropped support
#1652, [Windows], breaking: Windows XP and Windows Server 2003 (minimum is now Windows Vista).
Performance
#1679, [Windows]:
net_connections()andProcess.connections()are 10% faster.
Internals
#1671, [FreeBSD]: add CI testing/service for FreeBSD (Cirrus CI).
#1682, [PyPy]: added CI / test integration for PyPy via Travis.
Bug fixes
#1646, [FreeBSD], critical: many
Processmethods may cause a segfault due to a backward incompatible change in a C type on FreeBSD 12.0.#1695, [Linux], build-fail: could not compile on kernels <= 2.6.13 due to
PSUTIL_HAS_IOPRIOnot being defined.#1538, [NetBSD]:
Process.cwd()may returnENOENTinstead ofNoSuchProcess.#1627, [Linux]:
Process.memory_maps()can raiseKeyError.#1642, [SunOS]: querying basic info for PID 0 results in
FileNotFoundError.#1656, [Windows]:
Process.memory_full_info()raisesAccessDeniedeven for the current user andos.getpid().#1660, [Windows]:
Process.open_files()rewritten with proper error handling.#1662, [Windows]:
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.#1672: use the right C type when dealing with PIDs (int or long).
#1673, [OpenBSD]:
Process.connections(),Process.num_fds()andProcess.threads()raised wrong exception if process is gone.#1674, [SunOS]:
disk_partitions()may raiseOSError.#1684, [Linux]:
disk_io_counters()may raiseValueErroron systems not having/proc/diskstats.
5.6.7 — 2019-11-26¶
Bug fixes
#1630, [Windows], build-fail: can’t compile source distribution due to C syntax error.
5.6.6 — 2019-11-25¶
Bug fixes
#1616, critical: use of
Py_DECREFinstead ofPy_CLEARwill result in doublefree()and segfault (CVE-2019-18874).#1619, [OpenBSD], build-fail: compilation fails due to C syntax error.
#1179, [Linux]:
Process.cmdline()now handles processes that use inappropriate chars to separate args.
5.6.5 — 2019-11-06¶
Bug fixes
#1615, build-fail: remove
pyproject.tomlas it was causing installation issues.
5.6.4 — 2019-11-04¶
New APIs
#1527, [Linux]: added
Process.cpu_times()iowaitcounter, which is the time spent waiting for blocking I/O to complete.
Build and packaging
#1565: add PEP 517/8 build backend and requirements specification for better pip integration.
Bug fixes
#1126, [Linux], critical:
Process.cpu_affinity()segfaults on CentOS 5 / manylinux.Process.cpu_affinity()support for CentOS 5 was removed.#1528, [AIX], build-fail: compilation error on AIX 7.2 due to 32 vs 64 bit differences.
#1606, [SunOS], build-fail: compilation fails on SunOS 5.10.
#875, [Windows]:
Process.cmdline(),Process.environ()orProcess.cwd()may occasionally fail withERROR_PARTIAL_COPYwhich now gets translated toAccessDenied.#1535:
typeandfamilyfields returned bynet_connections()are not always turned into enums.#1536, [NetBSD]:
Process.cmdline()erroneously raisesZombieProcesserror 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, [macOS]: avoid calling
close()(in C) on possible negative integers.
5.6.3 — 2019-06-11¶
New APIs
#1494, [AIX]: added support for
Process.environ().
Bug fixes
#1276, [AIX]: can’t get whole
Process.cmdline().#1501, [Windows]:
Process.cmdline()andProcess.exe()raise unhandled “WinError 1168 element not found” exceptions for “Registry” and “Memory Compression” pseudo processes on Windows 10.#1526, [NetBSD]:
Process.cmdline()could raiseMemoryError.
5.6.2 — 2019-04-26¶
New APIs
#604, [Windows]: add new
getloadavg(), returning system load average calculation, including on Windows (emulated).#1476, [Windows]:
Process.ionice()can now set high I/O priority. New constants:IOPRIO_VERYLOW,IOPRIO_LOW,IOPRIO_NORMAL,IOPRIO_HIGH.
API changes
#1404, [Linux]:
cpu_count()withlogical=Falsefalls back to reading/sys/devices/system/cpu/*/topology/core_idif/proc/cpuinfodoesn’t provide the info.
Documentation
#1464: various docfixes (always point to Python 3 doc, fix links, etc.).
Internals
#1458: provide coloured test output. Also show failures on
KeyboardInterrupt.#1478: add make command to re-run tests failed on last run.
#1462, [Linux]: (tests) make tests invariant to
LANGsetting.#1463: scripts/cpu_distribution.py was broken.
Bug fixes
#1480, [Windows], critical:
cpu_count()withlogical=Falsecould cause a crash due to fixed read violation.#1491, [SunOS], memleak:
net_if_addrs(): usefree()againstifapstruct on error.#1223, [Windows]:
boot_time()may return incorrect value on Windows XP.#1456, [Linux]:
cpu_freq()returnsNoneinstead of 0.0 whenminandmaxfields can’t be determined.#1470, [Linux]:
disk_partitions(): fix corner case when/etc/mtabdoesn’t exist.#1471, [SunOS]:
Process.name()andProcess.cmdline()can returnSystemError.#1472, [Linux]:
cpu_freq()does not return all CPUs on Raspberry Pi 3.#1474: fix formatting of
psutil.tests()which mimicsps auxoutput.#1475, [Windows]:
OSError.winerrorattribute wasn’t properly checked resulting inWindowsError(ERROR_ACCESS_DENIED)being raised instead ofAccessDenied.#1477, [Windows]: wrong or absent error handling for private
NTSTATUSWindows APIs. Different process methods were affected by this.#1486, [AIX], [SunOS]:
AttributeErrorwhen interacting withProcessmethods involved inProcess.oneshot()context.#1493, [Linux]:
cpu_freq(): handle the case where/sys/devices/system/cpu/cpufreq/exists but it’s empty.
5.6.1 — 2019-03-11¶
Bug fixes
#1448, [Windows], critical: crash on import due to
rtlIpv6AddressToStringAnot available on Wine.#1451, [Windows], critical:
Process.memory_full_info()segfaults.NtQueryVirtualMemoryis now used instead ofQueryWorkingSetto calculate USS memory.#1329, [AIX], build-fail: psutil doesn’t compile on AIX 6.1.
5.6.0 — 2019-03-05¶
New APIs
#1433: new
Process.parents()method.
API changes
#1291, [macOS], critical, breaking:
Process.memory_maps()was removed because inherently broken (segfault) for years.#1420, [Windows]: in case of exception
disk_usage()now also shows the path name.
Performance
#1379, [Windows]:
Process.suspend()andProcess.resume()now useNtSuspendProcess/NtResumeProcessinstead of stopping / resuming all threads. Faster and more reliable.#1422, [Windows]: DLL-loaded Windows APIs are now loaded once on startup instead of per function call, significantly faster.
#1426, [Windows]:
PAGESIZEand number of processors is now calculated on startup.
Internals
#1428: in case of error, the traceback message now shows the underlying C function called which failed.
#1442: Python 3 is now the default interpreter used by Makefile.
Bug fixes
#1411, [BSD], critical, memleak: lack of
Py_DECREFcould cause segmentation fault on process instantiation.#1353:
process_iter()is now thread safe (it rarely raisedTypeError).#1394, [Windows]:
Process.name()andProcess.exe()may erroneously return “Registry” or fail with “[Error 0] The operation completed successfully”.QueryFullProcessImageNameWis now used instead ofGetProcessImageFileNameWin order to prevent that.#1419, [Windows]:
Process.environ()raisesNotImplementedErrorwhen querying a 64-bit process in 32-bit-WoW mode. Now it raisesAccessDenied.#1427, [macOS]:
Process.cmdline()andProcess.environ()may erroneously raiseOSErroron failedmalloc().#1429, [Windows]:
SE DEBUGwas not properly set for current process. It is now, and it should result in lessAccessDeniedexceptions for low PID processes.#1432, [Windows]:
Process.memory_info_ex()’s USS memory is miscalculated because we’re not using the actual systemPAGESIZE.#1439, [NetBSD]:
Process.connections()may return incomplete results if usingProcess.oneshot().#1447: original exception wasn’t turned into
NoSuchProcess/AccessDeniedexceptions when usingProcess.oneshot()context manager.
5.5.1 — 2019-02-15¶
API changes
#1384, [Windows]: on Windows >= 8.1,
Process.cmdline()falls back toNtQueryInformationProcessonERROR_ACCESS_DENIED.
Bug fixes
#1408, [AIX], build-fail: psutil won’t compile on AIX 7.1 due to missing header.
#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.
5.5.0 — 2019-01-23¶
New APIs
#1350, [FreeBSD]: added support for
sensors_temperatures().#1352, [FreeBSD]: added support for
cpu_freq().
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()andProcess.io_counters()methods are no longer exposed if not supported by the kernel.#1368, [Windows]: fix
Process.ionice()mismatch.#1370, [Windows]: improper usage of
CloseHandle()may lead to override the original error code when raising an exception.#1373: incorrect handling of cache in
Process.oneshot()context causesProcessinstances to return incorrect results.#1376, [Windows]:
OpenProcessnow usesPROCESS_QUERY_LIMITED_INFORMATIONwhere possible, reducingAccessDeniedfor system processes. Also check if a variable isNULLbefore freeing it.
5.4.8 — 2018-10-30¶
API changes
#1197, [Linux]:
cpu_freq()falls back to/proc/cpuinfoif/sys/devices/system/cpu/*is not available.#1310, [Linux]:
sensors_temperatures()falls back to/sys/class/thermalif/sys/class/hwmonis not available (e.g. Raspberry Pi).
Build and packaging
#1320, [POSIX]: better compilation support when using g++ instead of GCC.
Bug fixes
#715: do not print exception on import time in case
cpu_times()fails.#1004, [Linux]:
Process.io_counters()may raiseValueError.#1277, [macOS]: available and used memory (
virtual_memory()) metrics are not accurate.#1294, [Windows]:
Process.connections()may sometimes fail with intermittent0xC0000001.#1307, [Linux]:
disk_partitions()does not honourPROCFS_PATH.#1320, [AIX]: system CPU times (
cpu_times()) were being reported with ticks unit as opposed to seconds.#1332, [macOS]: psutil debug messages are erroneously printed all the time.
#1346, [SunOS]:
net_connections()returns an empty list.
5.4.7 — 2018-08-14¶
New APIs
#1309, [Linux]: added
STATUS_PARKEDconstant forProcess.status().
API changes
#1286, [macOS]:
OSXconstant is now deprecated in favor of newMACOS.#1321, [Linux]:
disk_io_counters()falls back to/sys/blockif/proc/diskstatsis not available.
Bug fixes
#1209, [macOS]:
Process.memory_maps()may fail withEINVALdue to poortask_for_pid()syscall.AccessDeniedis now raised instead.#1278, [macOS]:
Process.threads()incorrectly returns microseconds instead of seconds.#1279, [Linux], [macOS], [BSD]:
net_if_stats()may returnENODEV.#1294, [Windows]:
Process.connections()may sometimes fail withMemoryError.#1305, [Linux]:
disk_io_counters()may report inflated r/w bytes values.#1309, [Linux]:
Process.status()is unable to recognizeidleandparkedstatuses (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 withValueError.
5.4.6 — 2018-06-07¶
API changes
#1273:
net_if_addrs()named tuple’s name has been renamed fromsnictosnicaddr.
Bug fixes
#1258, [Windows], critical:
Process.username()may cause a segfault (Python interpreter crash).#1274, [Linux]: there was a small chance
Process.children()may swallowAccessDeniedexceptions.
5.4.5 — 2018-04-13¶
Bug fixes
#1268: setup.py’s
extra_requireparameter requires latest setuptools version, breaking quite a lot of installations.
5.4.4 — 2018-04-13¶
New APIs
#1239, [Linux]: expose kernel
slabmemory field forvirtual_memory().
API changes
#771, [Windows], breaking:
cpu_count()withlogical=Falseon Windows XP and Vista is no longer supported and returnsNone.
Bug fixes
#1194, [SunOS], critical: fix double
free()inProcess.cpu_num(). Also return nice value frompsinfoasgetpriority()doesn’t support real-time processes, and fix undefined behavior related to strict-aliasing rules and warnings.#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.#771, [Windows]: on systems using process groups (> 64 cores),
cpu_count()(both logical and cores) returns a wrong (smaller) number,cpu_times()withpercpu=Truereturns fewer CPUs, andcpu_stats()andcpu_freq()may return incorrect results.#1193, [SunOS]: return uid/gid from
/proc/pid/psinfoif there aren’t enough permissions for/proc/pid/cred.#1210, [Linux]:
cpu_percent()steal time may remain stuck at 100% due to Linux erroneously reporting a decreased steal time between calls.#1216, [Windows]: fix compatibility with Python 2.6.
#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 raiseTimeoutExpired.#1238, [Linux]:
sensors_battery()may returnNonein case battery is not listed as “BAT0” under/sys/class/power_supply.#1240, [Windows]:
cpu_times()float loses accuracy in a long running system.#1245, [Linux]:
sensors_temperatures()may fail withIOError“no such file”.#1255, [FreeBSD]:
swap_memory()stats were erroneously represented in KB.
5.4.3 — 2018-01-01¶
API changes
#775, [Windows]:
disk_partitions()returns mount points.
Bug fixes
5.4.2 — 2017-12-07¶
New APIs
#1173: add
PSUTIL_DEBUGenvironment variable to print debug messages on stderr.#1177, [macOS]: added support for
sensors_battery().
API changes
#1188:
Process.memory_info_ex()now warns withFutureWarninginstead ofDeprecationWarning.
Performance
#1183:
Process.children()is 2x faster on POSIX and 2.4x faster on Linux.
Internals
#1172, [Windows]:
make testdoes not work.
Bug fixes
#1152, [Windows]:
disk_io_counters()may return an empty dict.#1179, [Linux]:
Process.cmdline()can now split args for processes that overwrite/proc/pid/cmdlinewith spaces instead of null bytes.#1181, [macOS]:
Process.memory_maps()may raiseENOENT.#1187, [macOS]:
pids()does not return PID 0 on recent macOS versions.
5.4.1 — 2017-11-08¶
New APIs
#1164, [AIX]: add support for
Process.num_ctx_switches().
Dropped support
#1053, breaking: Python 3.3 (psutil still works but it’s no longer tested).
Internals
#1151:
python -m psutil.testsfails.
Bug fixes
#1154, [AIX], build-fail: psutil won’t compile on AIX 6.1.0.
#1150, [Windows]: when a process is terminated now the exit code is set to
SIGTERMinstead of0.#1167, [Windows]:
net_io_counters()packets count now also includes non-unicast packets.
5.4.0 — 2017-10-12¶
New platforms
#1123, [AIX]: AIX.
Bug fixes
#1127, [macOS], critical: invalid reference counting in
Process.open_files()may lead to segfault.#1133, [Windows], build-fail: can’t compile on newer versions of Visual Studio 2017 15.4.
#1138, [Linux], build-fail: can’t compile on CentOS 5.0 and RedHat 5.0.
#1009, [Linux]:
sensors_temperatures()may crash withIOError.#1012, [Windows]:
disk_io_counters()read_timeandwrite_timewere expressed in tens of micro seconds instead of milliseconds.#1129, [Linux]:
sensors_fans()may crash withIOError.#1131, [SunOS]: fix compilation warnings.
5.3.1 — 2017-09-10¶
Build and packaging
#1120, [Windows], breaking:
.exefiles are no longer uploaded on PyPI as per PEP-527. Only wheels are provided.
Documentation
#1124: documentation moved to http://psutil.readthedocs.io.
Bug fixes
#1105, [FreeBSD], build-fail: psutil does not compile on FreeBSD 12.
#1125, [BSD]:
net_connections()raisesTypeError.
5.3.0 — 2017-09-01¶
New APIs
#802:
disk_io_counters()andnet_io_counters()no longer wrap (restart from 0). New nowrap argument.#1025:
process_iter()accepts new attrs and ad_value parameters to invokeProcess.as_dict()inline.#1051:
disk_usage()on Python 3 is now able to accept bytes.#1091, [SunOS]: implemented
Process.environ().
API changes
#1039, breaking: returned types consolidation. 1) Windows /
Process.cpu_times(): fields #3 and #4 were int instead of float. 2) Linux / FreeBSD / OpenBSD:Process.connections()raddris now set to""instead ofNonewhen retrieving UNIX sockets.#1040, breaking: all strings are encoded by using OS fs encoding.
#1040, breaking: the following Windows APIs on Python 2 now return a string instead of unicode:
Process.memory_maps()’spathfield,WindowsService.binpath(),WindowsService.description(),WindowsService.display_name(),WindowsService.username().#928:
net_connections()andProcess.connections()laddrandraddrare now named tuples.#1015:
swap_memory()now reads/proc/meminfoinstead ofsysinfo()syscall, so it works withPROCFS_PATHfor containers.#1040: implemented full unicode support.
#1079, [FreeBSD]:
net_connections()fdnumber is now being set for real (instead of-1).
Build and packaging
#1060: source distribution now only includes relevant files.
Internals
#1058: test suite now enables all warnings by default.
Bug fixes
#1064, [NetBSD], critical:
swap_memory()may segfault in case of error.#1042, [FreeBSD], build-fail: psutil won’t compile on FreeBSD 12.
#1033, [macOS], [FreeBSD], memleak: memory leak for
net_connections()andProcess.connections()when retrieving UNIX sockets (kind='unix').#1047, [Windows], memleak:
Process.username(): memory leak in case exception is thrown.#1050, [Windows], memleak:
Process.memory_maps()leaks memory.#1067, [NetBSD], memleak:
Process.cmdline()leaks memory if process has terminated.#1068, [OpenBSD], memleak:
net_connections()leaks memory ifsysctl()fails.#989, [Windows]:
boot_time()may return a negative value.#1007, [Windows]:
boot_time()can have a 1 sec fluctuation between calls. The first call value is now cached.#1013, [FreeBSD]:
net_connections()may return incorrect PID.#1014, [Linux]:
Processclass can mask legitimateENOENTexceptions asNoSuchProcess.#1016:
disk_io_counters()raisesRuntimeErroron a system with no disks.#1017:
net_io_counters()raisesRuntimeErroron a system with no network cards installed.#1021, [Linux]:
Process.open_files()may erroneously raiseNoSuchProcessinstead of skipping a file which gets deleted while open files are retrieved.#1029, [macOS], [FreeBSD]:
Process.connections()withfamily=unixon Python 3 doesn’t properly handle unicode paths and may raiseUnicodeDecodeError.#1040: fixed many unicode related issues such as
UnicodeDecodeErroron Python 3 + POSIX and invalid encoded data on Windows.#1044, [macOS]: different
Processmethods incorrectly raiseAccessDeniedfor zombie processes.#1046, [Windows]:
disk_partitions()on Windows overrides user’sSetErrorMode.#1048, [Windows]:
users()’shostfield reports an invalid IP address.#1055:
cpu_count()is no longer cached (CPUs can be disabled at runtime on Linux).Process.cpu_percent()also affected.#1058: fixed Python warnings.
#1062:
disk_io_counters()andnet_io_counters()raiseTypeErrorif no disks or NICs are installed on the system.#1063, [NetBSD]:
net_connections()may list incorrect sockets.#1065, [OpenBSD]:
Process.cmdline()may raiseSystemError.#1069, [FreeBSD]:
Process.cpu_num()may return 255 for certain kernel processes.#1071, [Linux]:
cpu_freq()may raiseIOErroron old RedHat distros.#1074, [FreeBSD]:
sensors_battery()raisesOSErrorin case of no battery.#1075, [Windows]:
net_if_addrs():inet_ntop()return value is not checked.#1077, [SunOS]: on SunOS 5.10
net_if_addrs()shows garbage addresses andnet_connections()does not work.#1079, [FreeBSD]:
net_connections()didn’t list locally connected sockets.#1085:
cpu_count()return value is now checked and forced toNoneif <= 1.#1087:
Process.cpu_percent()guards againstcpu_count()returningNoneand assumes 1 instead.#1093, [SunOS]:
Process.memory_maps()shows wrong 64 bit addresses.#1094, [Windows]: fix
pid_exists()returning wrong result. AllOpenProcessAPIs now verify the PID is actually running.#1098, [Windows]:
Process.wait()may erroneously return sooner, when the PID is still alive.#1099, [Windows]:
Process.terminate()may raiseAccessDeniedeven if the process already died.#1101, [Linux]:
sensors_temperatures()may raiseENODEV.
5.2.2 — 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.
#1004, [Linux]:
Process.io_counters()may raiseValueError.#1006, [Linux]:
cpu_freq()may returnNoneon some Linux versions that do not support the function. Let’s not make the function available instead.#1009, [Linux]:
sensors_temperatures()may raiseOSError.#1010, [Linux]:
virtual_memory()may raiseValueErroron Ubuntu 14.04.
5.2.1 — 2017-03-24¶
Bug fixes
#981, [Linux]:
cpu_freq()may return an empty list.#993, [Windows]:
Process.memory_maps()on Python 3 may raiseUnicodeDecodeError.#996, [Linux]:
sensors_temperatures()may not show all temperatures.#997, [FreeBSD]:
virtual_memory()may fail due to missingsysctlparameter on FreeBSD 12.
5.2.0 — 2017-03-05¶
New APIs
#974, [Linux]: add
sensors_fans()function.#976, [Windows]:
Process.io_counters()has 2 new fields:other_countandother_bytes.#976, [Linux]:
Process.io_counters()has 2 new fields:read_charsandwrite_chars.
Bug fixes
#985, [Windows], critical: fix a crash in
Process.open_files()when the worker thread forNtQueryObjecttimes out.#872, [Linux], build-fail: can now compile on Linux by using MUSL C library.
#986, [Linux]:
Process.cwd()may raiseNoSuchProcessinstead ofZombieProcess.
5.1.3 — 2017-02-07¶
Bug fixes
#971, [Linux]:
sensors_temperatures()didn’t work on CentOS 7.#973:
cpu_percent()may raiseZeroDivisionError.
5.1.2 — 2017-02-03¶
Bug fixes
#966, [Linux]:
sensors_battery()power_pluggedmay erroneously returnNoneon Python 3.#968, [Linux]:
disk_io_counters()raisesTypeErroron Python 3.#970, [Linux]:
sensors_battery()nameandlabelfields on Python 3 are bytes instead of str.
5.1.1 — 2017-02-03¶
API changes
#966, [Linux]:
sensors_battery()percentis a float and is more precise.
Bug fixes
#964, [Windows]:
Process.username()andusers()may return badly decoded characters 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 withFileNotFoundError, and itspower_pluggedfield may lie.
5.1.0 — 2017-02-01¶
New APIs
#357: added
Process.cpu_num()(what CPU a process is on).#371, [Linux]: added
sensors_temperatures().#941: added
cpu_freq()(CPU frequency).#955, [Linux], [Windows]: added
sensors_battery().#956:
Process.cpu_affinity()can now be passed[]argument as an alias to set affinity against all eligible CPUs.
Bug fixes
#948, build-fail: cannot install psutil with
PYTHONOPTIMIZE=2.#687, [Linux]:
pid_exists()no longer returnsTrueif passed a process thread ID.#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:
Popenwait()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.
5.0.1 — 2016-12-21¶
Build and packaging
#939: tar.gz distribution went from 1.8M to 258K.
Bug fixes
#609, [SunOS], build-fail: psutil does not compile on Solaris 10.
#936, [Windows], build-fail: fix compilation error on VS 2013.
#811, [Windows]: provide a more meaningful error message if trying to use psutil on unsupported Windows XP.
#940, [Linux]:
cpu_percent()andcpu_times_percent()were calculated incorrectly asiowait,guestandguest_nicetimes were not properly taken into account.
5.0.0 — 2016-11-06¶
New APIs
#799: new
Process.oneshot()context manager (+2x faster in general, +2x to +6x on Windows).
Bug fixes
#933, [Windows], memleak: memory leak in
cpu_stats()andWindowsService.description()method.#932, [NetBSD]:
net_connections()andProcess.connections()may fail without raising an exception.#943: better error message in case of version conflict on import.
4.4.2 — 2016-10-26¶
Bug fixes
#931, [SunOS], build-fail: psutil no longer compiles on Solaris.
4.4.1 — 2016-10-25¶
Bug fixes
4.4.0 — 2016-10-23¶
New APIs
#874, [Windows]: make
net_if_addrs()also return thenetmask.
API changes
#887, [Linux]:
virtual_memory()availableandusedare more precise and matchfreeutility. Also handles LXC containers.
Internals
#891: scripts/procinfo.py has been updated and provides a lot more info.
Bug fixes
#514, [macOS], critical:
Process.memory_maps()can segfault.#926, [macOS], critical:
Process.environ()can crash the interpreter on Python 3 if the process environment contains an invalid unicode string.#783, [macOS]:
Process.status()may erroneously returnSTATUS_RUNNINGfor zombie processes.#798, [Windows]:
Process.open_files()returns an 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:
ValueErroris raised if a negative integer is passed tocpu_percent()functions.#892, [Linux]:
Process.cpu_affinity()with[-1]as arg raisesSystemErrorwith no error set; nowValueErroris raised.#906, [BSD]:
disk_partitions()withall=Falsereturned an empty list. Now the argument is ignored and all partitions are always returned.#907, [FreeBSD]:
Process.exe()may fail withOSErrorENOENT.#908, [macOS], [BSD]: different process methods could erroneously mask the real error for high-privileged PIDs and raise
NoSuchProcessandAccessDeniedinstead ofOSErrorandRuntimeError.#909, [macOS]:
Process.open_files()andProcess.connections()methods may raiseOSErrorwith no exception set if process is gone.#916, [macOS]: fix many compilation warnings.
4.3.1 — 2016-09-01¶
Build and packaging
#881:
make installnow works also when using a virtual env.
Bug fixes
#870, [Windows], memleak: handle leak inside
psutil_get_process_data.#854:
Process.as_dict()raisesValueErrorif passed an erroneous attrs name.#857, [SunOS]:
Process.cpu_times(),Process.cpu_percent(),Process.threads()andProcess.memory_maps()may raiseRuntimeErrorif attempting to query a 64bit process with a 32bit Python. “Null” values are returned as a fallback.#858:
Process.as_dict()should not callProcess.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 raiseTimeoutExpiredwith wrong timeout unit (ms instead of sec).
4.3.0 — 2016-06-18¶
Bug fixes
#812, [NetBSD], build-fail: fix compilation on NetBSD-5.x.
#810, [Windows]: Windows wheels are incompatible with pip 7.1.2.
#823, [NetBSD]:
virtual_memory()raisesTypeErroron Python 3.#829, [POSIX]:
disk_usage()percentfield 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.
4.2.0 — 2016-05-14¶
New APIs
#795, [Windows]: new APIs to deal with Windows services:
win_service_iter()andwin_service_get().#800, [Linux]:
virtual_memory()returns a newsharedfield.
Performance
#819, [Linux]: speedup
/procparsing: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 raiseOSErrorfor certain NIC cards.#813:
Process.as_dict()should ignore extraneous attribute names which get attached to theProcessinstance.
4.1.0 — 2016-03-12¶
New APIs
#777, [Linux]:
Process.open_files()on Linux returns 3 new fields:position,modeandflags.#779:
Process.cpu_times()returns two new fields,children_userandchildren_system(always set to 0 on macOS and Windows).#789, [Windows]:
cpu_times()returns two new fields:interruptanddpc. Same forcpu_times_percent().#792: new
cpu_stats()function returning number of CPUctx_switches,interrupts,soft_interruptsandsyscalls.
Bug fixes
#780, [macOS], build-fail: psutil does not compile with some GCC versions.
#790, [macOS], build-fail: psutil won’t compile on macOS 10.4.
#774, [FreeBSD]:
net_io_counters()dropout is no longer set to 0 if the kernel provides it.#776, [Linux]:
Process.cpu_affinity()may erroneously raiseNoSuchProcess.#786:
net_if_addrs()may report incomplete MAC addresses.#788, [NetBSD]:
virtual_memory()buffersandsharedvalues were set to 0.
4.0.0 — 2016-02-17¶
New APIs
#523, [Linux], [FreeBSD]:
disk_io_counters()returns a newbusy_timefield.#753, [Linux], [macOS], [Windows]: process USS and PSS (Linux) “real” memory stats.
#755:
Process.memory_percent()memtypeparameter.#756, [Linux]:
disk_io_counters()returns 2 new fields:read_merged_countandwrite_merged_count.
Build and packaging
#660, [Windows]: make.bat is smarter in finding alternative VS install locations.
Internals
#758: tests now live in psutil namespace.
#762: add scripts/procsmem.py.
Bug fixes
#751, [Linux], critical: fixed call to
Py_DECREFon possibleNULLobject.#704, [SunOS], build-fail: psutil does not compile on Solaris sparc.
#741, [OpenBSD], build-fail: psutil does not compile on mips64.
#764, [NetBSD], build-fail: fix compilation on NetBSD-6.x.
#685, [Linux]:
virtual_memory()provides wrong results on systems with a lot of physical memory.#734: on Python 3 invalid UTF-8 data is not correctly handled for
Process.name(),Process.cwd(),Process.exe(),Process.cmdline()andProcess.open_files()methods resulting inUnicodeDecodeErrorexceptions.'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()andProcess.cwd()could return a wrong result or incorrectly report anAccessDeniederror.#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.#766, [Linux]:
net_connections()can’t handle malformed/proc/net/unixfile.#767, [Linux]:
disk_io_counters()may raiseValueErroron 2.6 kernels and it’s broken on 2.4 kernels.#770, [NetBSD]:
disk_io_counters()metrics didn’t update.
3.4.2 — 2016-01-20¶
New APIs
#728, [SunOS]: exposed
PROCFS_PATHconstant to change the default location of/procfilesystem.
Bug fixes
#724, [FreeBSD]:
virtual_memory()totalis incorrect.#730, [FreeBSD]:
virtual_memory()crashes with “OSError: [Errno 12] Cannot allocate memory”.
3.4.1 — 2016-01-15¶
New platforms
#557, [NetBSD]: NetBSD.
API changes
#718:
process_iter()is now thread safe.
Performance
#708, [Linux]:
net_connections()andProcess.connections()on Python 2 can be up to 3x faster in case of many connections. AlsoProcess.memory_maps()is slightly faster.
Bug fixes
#715, critical: don’t crash at import time if
cpu_times()fails for some reason.#714, [OpenBSD]:
virtual_memory()cachedvalue was always set to 0.#717, [Linux]:
Process.open_files()fails if deleted files are still visible.#722, [Linux]:
swap_memory()no longer crashes ifsin/soutcan’t be determined due to missing/proc/vmstat.#724, [FreeBSD]:
virtual_memory()totalis slightly incorrect.
3.3.0 — 2015-11-25¶
New platforms
#615, [OpenBSD]: OpenBSD.
New APIs
#558, [Linux]: exposed
PROCFS_PATHconstant to change the default location of/procfilesystem.
Bug fixes
#692, [POSIX]:
Process.name()is no longer cached as it may change.
3.2.2 — 2015-10-04¶
Bug fixes
#610, [SunOS], build-fail: fix build and tests on Solaris 10.
#678, [Linux], build-fail: can’t install psutil due to bug in setup.py.
#688, [Windows], build-fail: compilation fails with MSVC 2015, Python 3.5.
#690, [Windows], build-fail: can’t compile with MSVC 2015, which enforces the C++11 rule forbidding duplicate values in an unscoped enum.
#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.#623, [Linux]: process or system connections raise
ValueErrorif IPv6 is not supported by the system.
3.2.1 — 2015-09-03¶
Bug fixes
#677, [Linux], build-fail: can’t install psutil due to bug in setup.py.
3.2.0 — 2015-09-02¶
New APIs
#644, [Windows]: added support for
CTRL_C_EVENTandCTRL_BREAK_EVENTsignals to use withProcess.send_signal().
API changes
#663, [POSIX]:
net_if_addrs()now returns point-to-point (VPNs) addresses.#655, [Windows]: fix various unicode handling issues. On Python 2, string APIs now return encoded strings using
sys.getfilesystemencoding().
Internals
#648, [macOS]: CI test integration.
Bug fixes
#670, [Windows], critical: segfault of
net_if_addrs()in case of non-ASCII NIC names.#659, [Linux], build-fail: compilation error on Suse 10.
#664, [Linux], build-fail: compilation error on Alpine Linux.
#672, [Windows], build-fail: compilation fails if using Windows SDK v8.0.
#513, [Linux]: fixed integer overflow for
RLIM_INFINITY.#641, [Windows]: fixed many compilation warnings.
#652, [Windows]:
net_if_addrs()UnicodeDecodeErrorin case of non-ASCII NIC names.#655, [Windows]:
net_if_stats()UnicodeDecodeErrorin case of non-ASCII NIC names.#675, [Linux]:
net_connections():UnicodeDecodeErrormay occur when listing UNIX sockets.
3.1.1 — 2015-07-15¶
Bug fixes
#603, [Linux]:
Process.ionice()set value range is incorrect.#645, [Linux]:
cpu_times_percent()may produce negative results.#656:
from psutil import *does not work.
3.1.0 — 2015-07-15¶
API changes
#534, [Linux]:
disk_partitions()added support for ZFS filesystems.
Documentation
#647: new dev guide: https://github.com/giampaolo/psutil/blob/master/docs/devguide.rst.
Internals
#646, [Windows]: continuous tests integration for Windows with https://ci.appveyor.com/project/giampaolo/psutil.
#651: continuous code quality test integration with scrutinizer-ci.com.
Bug fixes
#340, [Windows], critical:
Process.open_files()no longer hangs (uses a thread with timeout).#627, [Windows]:
Process.name()no longer raisesAccessDeniedfor pids owned by another user.#636, [Windows]:
Process.memory_info()raisesAccessDenied.5ae30c79, [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]:
*connectionsfunctions 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.
3.0.1 — 2015-06-18¶
Bug fixes
#635, [POSIX], critical: crash on module import if
enumpackage is installed on Python < 3.4.#632, [Linux]: better error message if cannot parse process UNIX connections.
#634, [Linux]:
Process.cmdline()does not include empty string arguments.
3.0.0 — 2015-06-13¶
New APIs
#250: new
net_if_stats()returning NIC statistics (isup,duplex,speed,mtu).#376: new
net_if_addrs()returning all NIC addresses a-laifconfig.
API changes
#594, breaking: all deprecated APIs were removed.
#469: on Python >= 3.4
IOPRIO_CLASS_*and*_PRIORITY_CLASSconstants returned byProcess.ionice()andProcess.nice()are enums instead of plain integers.#582: connection constants returned by
net_connections()andProcess.connections()were turned from int to enums on Python > 3.4.#589:
Process.cpu_affinity()accepts any kind of iterable (set, tuple, …), not only lists.#599, [Windows]:
Process.name()can now be determined for all processes even when running as a limited user.
Build and packaging
#587: move native extension into the package.
Internals
#581: add
.gitignore.#602: pre-commit GIT hook.
#629: enhanced support for
pytestandnosetest runners.#616, [Windows]: add
inet_ntop()function for Windows XP.
Bug fixes
#512, [BSD], critical: fix segfault in
net_connections().#586, [FreeBSD], critical:
Process.cpu_affinity()segfaults on set in case an invalid CPU number is provided.#593, [FreeBSD], critical:
Process.memory_maps()segfaults.#607, [Linux], build-fail: can’t compile on old RedHat versions where
DUPLEX_UNKNOWNis not defined.#428, [POSIX]: correct handling of zombie processes on POSIX. Introduced new
ZombieProcessexception class.#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 raiseKeyError.#606:
Process.parent()may swallowNoSuchProcessexceptions.#611, [SunOS]:
net_io_counters()has the sent and received counters swapped.#614, [Linux]:
cpu_count()withlogical=Falsereturns 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.
2.2.1 — 2015-02-02¶
Bug fixes
#572, [Linux]: fix “ValueError: ambiguous inode with multiple PIDs references” for
Process.connections().
2.2.0 — 2015-01-06¶
New APIs
#569, [FreeBSD]: add support for
Process.cpu_affinity()on FreeBSD.
Dropped support
#521, breaking: Python 2.4 and 2.5.
Internals
#553: add scripts/pstree.py.
#568: add scripts/pidof.py.
Bug fixes
#496, [SunOS], critical: can’t import psutil.
#556, [Linux], memleak: lots of file handles were left open.
#569, [FreeBSD], memleak: fix memory leak in
cpu_count()withlogical=False.#547, [POSIX]:
Process.username()may raiseKeyErrorif UID can’t be resolved.#551, [Windows]: get rid of the unicode hack for
net_io_counters()NIC names.#561, [Linux]:
net_connections()might skip some legitimate UNIX sockets.#564: C extension version mismatch is now detected at import time.
#565, [Windows]: use proper encoding for
Process.username()andusers().#567, [Linux]: in the alternative implementation of
Process.cpu_affinity()PyList_AppendandPy_BuildValuereturn values are not checked.#571, [Linux]:
Process.open_files()might swallowAccessDeniedexceptions and return an incomplete list of open files.
2.1.3 — 2014-09-26¶
Bug fixes
#536, [Linux], build-fail: fix “undefined symbol: CPU_ALLOC” compilation error.
2.1.2 — 2014-09-21¶
Build and packaging
#505, [Windows]: distribution as wheel packages.
Internals
#407: project moved from Google Code to Github; code moved from Mercurial to Git.
#492: use
toxto run tests on multiple Python versions.#511: add scripts/ps.py.
Bug fixes
#340, [Windows], critical:
Process.open_files()no longer hangs.#501, [Windows]:
disk_io_counters()may return negative values.#503, [Linux]: in rare conditions
Process.exe(),Process.open_files()andProcess.connections()can raiseOSError(ESRCH)instead ofNoSuchProcess.#504, [Linux]: can’t build RPM packages via setup.py.
#506, [Linux]: Python 2.4 support was broken.
#522, [Linux]:
Process.cpu_affinity()might returnEINVAL.#529, [Windows]:
Process.exe()may raise unhandledWindowsErrorexception for PIDs 0 and 4.#530, [Linux]:
disk_io_counters()may crash on old Linux distros (< 2.6.5).#533, [Linux]:
Process.memory_maps()may raiseTypeErroron old Linux distros.
2.1.1 — 2014-04-30¶
Bug fixes
#446, [Windows]: fix encoding error when using
net_io_counters()on Python 3.#460, [Windows]:
net_io_counters()wraps after 4G.#497, [Linux]:
net_connections()exceptions.
2.1.0 — 2014-04-08¶
New APIs
#387: system-wide open connections a-la
netstat(addnet_connections()).
Bug fixes
#421, [SunOS], build-fail: psutil does not compile on SunOS 5.10.
#489, [Linux]:
disk_partitions()returns an empty list.
2.0.0 — 2014-03-10¶
New APIs
#427: add
cpu_count().
API changes
#447:
wait_procs()timeout parameter is now optional.#452: make
Processinstances hashable and usable withset()s.
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 been 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
Processget_*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
Processset_*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, allProcessclass properties have been turned into methods. This is the only case in 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()
#479, breaking: long deprecated
psutil.errormodule is gone; exception classes now live in “psutil” namespace only.#463: timeout parameter of
cpu_percent*functions defaults to 0.0 instead of 0.1, avoiding a common source of accidental slowdowns.Processinstances’retcodeattribute returned bywait_procs()has been renamed toreturncodefor consistency withsubprocess.Popen.
Performance
#477:
Process.cpu_percent()is about 30% faster.#478, [Linux]: almost all APIs are about 30% faster on Python 3.X.
Build and packaging
#424, [Windows]: installer for Python 3.X 64 bit.
Documentation
#468: move documentation to readthedocs.com.
Internals
#453: tests on Python < 2.7 require
unittest2module.#459: add a Makefile for running tests and other repetitive tasks (also on Windows).
Bug fixes
#340, [Windows], critical:
Process.open_files()no longer hangs.#448, [Windows], memleak:
Process.children()andProcess.ppid()memory leak.#193:
Popenconstructor can throw an exception if the spawned process terminates quickly.#443, [Linux]: fix a potential overflow issue for
Process.cpu_affinity()(set) on systems with more than 64 CPUs.#457, [POSIX]:
pid_exists()always returnsTruefor PID 0.#461: named tuples are not pickle-able.
#466, [Linux]:
Process.exe()improper null bytes handling.#470:
wait_procs()might not wait.#471, [Windows]:
Process.exe()improper unicode handling.#473:
Popenwait()method does not setreturncodeattribute.#474, [Windows]:
Process.cpu_percent()is no longer capped at 100%.#476, [Linux]: encoding error for
Process.name()andProcess.cmdline().
1.2.1 — 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.
1.2.0 — 2013-11-20¶
New APIs
#440: new
wait_procs()utility function which waits for multiple processes to terminate.
API changes
#439: assume
os.getpid()if no argument is passed toProcessclass constructor.
Bug fixes
#348, [Windows], critical: fix “ImportError: DLL load failed” occurring on module import on Windows XP / Vista.
1.1.3 — 2013-11-07¶
Bug fixes
#442, [Linux], build-fail: psutil won’t compile on certain versions of Linux because of missing prlimit(2) syscall.
1.1.2 — 2013-10-22¶
Bug fixes
#442, [Linux], build-fail: psutil won’t compile on Debian 6.0 because of missing prlimit(2) syscall.
1.1.1 — 2013-10-08¶
Bug fixes
#442, [Linux], build-fail: psutil won’t compile on kernels < 2.6.36 due to missing prlimit(2) syscall.
1.1.0 — 2013-09-28¶
New APIs
#412, [Linux]: add
Process.rlimit().
API changes
#408: turn
STATUS_*andCONN_*constants into plain Python strings.
Performance
#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 alsoProcess.cmdline().
Build and packaging
#410: host tar.gz and Windows binary files are on PyPI.
Bug fixes
#413, [Windows], memleak:
Process.memory_info()leaks memory.#392, [Windows]:
cpu_times_percent()returns negative percentages.#408:
STATUS_*andCONN_*constants don’t properly serialize on JSON.#411, [Windows]: scripts/disk_usage.py may pop-up a GUI error.
#414, [Windows]:
Process.exe()on Windows XP may raiseERROR_INVALID_PARAMETER.#416:
disk_usage()doesn’t work well with unicode path names.#430, [Linux]:
Process.io_counters()reports wrong number of r/w syscalls.#435, [Linux]:
net_io_counters()might report erroneous NIC names.#436, [Linux]:
net_io_counters()reports a wrongdropinvalue.
1.0.1 — 2013-07-12¶
Bug fixes
#405:
net_io_counters()pernic=Trueno longer works as intended in 1.0.0.
1.0.0 — 2013-07-10¶
New platforms
#18, [SunOS]: Solaris (yay!) (thanks Justin Venus).
API changes
#367:
Process.connections()statusis no longer a string but a constant object (psutil.CONN_*).Process.connections()local_addressandremote_addressfields renamed toladdrandraddr.psutil.network_io_counters() renamed to
net_io_counters().
Internals
#380: test suite exits with non-zero on failure.
#391: introduce unittest2 facilities and provide workarounds if unittest2 is not installed (Python < 2.7).
Bug fixes
#404, [Linux], build-fail:
sched_*affinity()are implicitly declared.#374, [Windows]: negative memory usage reported if process uses a lot of memory.
#379, [Linux]:
Process.memory_maps()may raiseValueError.#394, [macOS]: mapped memory regions of
Process.memory_maps()report incorrect file name.
0.7.1 — 2013-05-03¶
Bug fixes
#325, [BSD]:
virtual_memory()can raiseSystemError.#370, [BSD]:
Process.connections()requires root.#372, [BSD]: different process methods raise
NoSuchProcessinstead ofAccessDenied.
0.7.0 — 2013-04-12¶
New APIs
#328, [Windows]:
Process.ionice()support.#359: add
boot_time()as a substitute ofpsutil.BOOT_TIMEsince the latter cannot reflect system clock updates.#361, [Linux]:
cpu_times()now includes newsteal,guestandguest_nicefields available on recent Linux kernels. Also,cpu_percent()is more accurate.#362: add
cpu_times_percent()(per-CPU-time utilization as a percentage).
API changes
#246: psutil.error module is deprecated and scheduled for removal.
Internals
#233: code migrated to Mercurial (yay!)
Bug fixes
#313, [Linux], critical:
virtual_memory()andswap_memory()can crash on certain exotic Linux flavors having an incomplete/procinterface. If that’s the case we now set the unretrievable stats to0and raiseRuntimeWarninginstead.#341, [Linux], critical: psutil might crash on import due to error in retrieving system terminals map.
#333, [macOS], memleak: leak of Mach ports.
#339, [FreeBSD], memleak:
get_pid_list()can allocate all the memory on system.#234, [Windows]:
disk_io_counters()fails to list certain disks.#264, [Windows]: use of
disk_partitions()may cause a message box to appear.#315, [macOS]: fix some compilation warnings.
#317, [Windows]: cannot set process CPU affinity above 31 cores.
#319, [Linux]:
Process.memory_maps()raisesKeyError‘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_timeandwrite_timeparameters were reporting microseconds not milliseconds.#331:
Process.cmdline()is no longer cached after first access as it may change.#337, [Linux]:
Processmethods not working because of a poor/procimplementation will raiseNotImplementedErrorrather thanRuntimeErrorandProcess.as_dict()will not blow up.#338, [Linux]:
disk_io_counters()fails to find some disks.#344, [FreeBSD]:
swap_memory()might return incorrect results due tokvm_open(3)not being called.#351, [Windows]: if psutil is compiled with MinGW32 (provided installers for py2.4 and py2.5 are)
disk_io_counters()will fail.#356:
Process.parent()now checks whether parent PID has been reused in which case returnsNone.#365:
Process.nice()(set) should check PID has not been reused by another process.#366, [FreeBSD]:
Process.memory_maps(),Process.num_fds(),Process.open_files()andProcess.cwd()methods raiseRuntimeErrorinstead ofAccessDenied.
0.6.1 — 2012-08-16¶
API changes
#316:
Process.cmdline()property now makes a better job at guessing the process executable from the cmdline.Process.exe()can now return an empty string instead of raisingAccessDenied.
Bug fixes
#316:
Process.exe()was resolved in case it was a symlink.#318: Python 2.4 compatibility was broken.
0.6.0 — 2012-08-13¶
New APIs
#216, [POSIX]: add
Process.connections()UNIX sockets support.#222, [macOS]: add support for
Process.cwd().#261: add
Process.memory_info_ex().#311: add
virtual_memory()andswap_memory(). Old memory-related functions are deprecated. New example scripts: scripts/free.py and scripts/meminfo.py.#312:
net_io_counters()adds 4 new fields:errin,errout,dropinanddropout.
API changes
#295, [macOS]:
Process.exe()path is now determined by asking the OS instead of being guessed fromProcess.cmdline().#297, [macOS]:
Process.name(),Process.memory_info(),Process.memory_percent(),Process.cpu_times(),Process.cpu_percent(),Process.num_threads()no longer raiseAccessDeniedfor other users’ processes and are 2.5x faster.#301:
process_iter()now yields processes sorted by their PIDs.#304, [Windows]:
Process.create_time(),Process.cpu_times(),Process.cpu_percent(),Process.memory_info(),Process.memory_percent(),Process.num_handles(),Process.io_counters()no longer raiseAccessDeniedfor other users’ processes.psutil.phymem_usage()is deprecated (usevirtual_memory()).psutil.virtmem_usage()is deprecated (useswap_memory()).[Linux]:
psutil.phymem_buffers()is deprecated (usevirtual_memory()).[Linux]:
psutil.cached_phymem()is deprecated (usevirtual_memory()).
Performance
#220, [FreeBSD]:
net_connections()has been rewritten in C and no longer requireslsof.
Internals
#300: add scripts/pmap.py.
6e45ac1a: add scripts/netstat.py.
Bug fixes
#303, [Windows], critical: potential heap corruption in
Process.num_threads()andProcess.status()methods.#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.#305, [FreeBSD], build-fail: can’t compile on FreeBSD 9 due to removal of
utmp.h.#298, [macOS], [BSD], memleak: memory leak in
Process.num_fds().#299, memleak: potential memory leak every time
PyList_New(0)is used.#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.#310:
Process.open_files()might not return files which can not be accessed due to limited permissions.AccessDeniedis now raised instead.
0.5.1 — 2012-06-29¶
API changes
#293, [Windows]:
Process.exe()path is now determined by asking the OS instead of being guessed fromProcess.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.
0.5.0 — 2012-06-27¶
New APIs
#195, [Windows]: add
Process.num_handles().#209:
disk_partitions()now provides also mount options.#238, [Linux], [Windows]: add
Process.cpu_affinity().#242: add
recursive=TruetoProcess.children(): return all process descendants.#260: add
Process.memory_maps().#278: add
Process.as_dict().#284, [POSIX]: add
Process.num_fds().
API changes
#273:
psutil.get_process_list()is deprecated.#281:
Process.ppid(),Process.name(),Process.exe(),Process.cmdline()andProcess.create_time()are now cached after first access, soNoSuchProcessis no longer raised if the process is gone in the meantime.#282:
psutil.STATUS_*constants can now be compared by using their string representation.#290:
Process.nice()property is deprecated in favor of newget_nice()andset_nice()methods.
Dropped support
#257, [Windows], breaking: Windows 2000.
Performance
#245, [POSIX]:
Process.wait()incrementally consumes less CPU cycles.#258, [Linux]:
Process.memory_info()is now 0.5x faster.#262, [Windows]:
disk_partitions()was slow due to inspecting the floppy disk drive also when parameter isall=False.#283: speedup
Process.is_running()by caching its return value in case the process is terminated.#287:
process_iter()now cachesProcessinstances between calls.
Build and packaging
#274: psutil no longer requires
2to3at installation time in order to work with Python 3.
Bug fixes
#240, [macOS], critical: incorrect use of
free()forProcess.connections().#193:
Popenconstructor can throw an exception if the spawned process terminates quickly.#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 raisesNoSuchProcessfor processes owned by another user. It now raisesAccessDeniedinstead.#266, [Windows]:
psutil.get_pid_list()only shows 1024 processes.#267, [macOS]:
Process.connections()returns wrong remote address.#272, [Linux]:
Process.open_files()potential race condition can lead to unexpectedNoSuchProcessexception. Also, we can get incorrect reports of not absolutized path names.#275, [Linux]:
Process.io_counters()erroneously raisesNoSuchProcesson 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.
0.4.1 — 2011-12-14¶
Bug fixes
#230, [Windows], [macOS], memleak: fix memory leak in
Process.connections().#236, [Windows], memleak: fix memory/handle leak in
Process.memory_info(),Process.suspend()andProcess.resume()methods.#228: some example scripts were not working with Python 3.
#232, [Linux]:
psutil.phymem_usage()can report erroneous values which are different thanfreecommand.
0.4.0 — 2011-10-29¶
New APIs
#150: add
net_io_counters().#154, [FreeBSD]: add support for
Process.cwd().#206: add
disk_io_counters().#217:
Process.connections()now has a kind argument to filter for connections with different criteria.
API changes
#198:
Process.wait()withtimeout=0can now be used to make the function return immediately.
Performance
#221, [FreeBSD]:
Process.open_files()has been rewritten in C and no longer relies onlsof.
Build and packaging
#157, [Windows]: provide installer for Python 3.2 64-bit.
Internals
#213: add scripts/iotop.py.
#223: add scripts/top.py.
#227: add scripts/nettop.py.
Bug fixes
#188, [Linux], critical: psutil import error on Linux ARM architectures.
#200, [Linux], critical:
psutil.NUM_CPUSnot working on armel and sparc architectures and causing crash on module import.#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.
#144, [Linux]: no longer support 0 special PID.
#194, [POSIX]:
Process.cpu_percent()now reports a percentage over 100 on multi core processors.#197, [Linux]:
Process.connections()is broken on platforms not supporting IPv6.#201, [Linux]:
Process.connections()is broken on big-endian architectures.#211:
Processinstance can unexpectedly raiseNoSuchProcessif tested for equality with another object.
0.3.0 — 2011-07-08¶
New APIs
#125: add
cpu_times()andcpu_percent()per-cpu support.#163: add
Process.terminal().#171: add
get_phymem()andget_virtmem(). Oldtotal_*,avail_*andused_*memory functions are deprecated.#172: add
disk_usage().#174: add
disk_partitions().
Build and packaging
#179: setuptools is now used in setup.py.
Bug fixes
#159, [Windows], memleak:
SetSeDebug()does not close handles or unset impersonation on return.#166, memleak:
Process.memory_info()leaks handles hogging system resources.#178, [macOS], memleak:
Process.threads()leaks memory.#164, [Windows]:
Process.wait()raises aTimeoutExceptionwhen a process returns-1.#165:
Process.status()raises an unhandled exception.#168:
cpu_percent()returns erroneous results when used in non-blocking mode.#180, [Windows]:
Process.num_threads()andProcess.threads()methods can raiseNoSuchProcessexception while process still exists.
0.2.1 — 2011-03-20¶
New APIs
#64: add
Process.io_counters().#116: add
Process.wait().#134: add
Process.threads().#137: add
Process.uids()andProcess.gids().#140: add
boot_time().#142: add
Process.nice().#143: add
Process.status().#147, [Linux]: add
Process.ionice().#148: add
Popenclass combiningsubprocess.PopenandProcessin a single interface.
API changes
#136, [FreeBSD]:
Process.exe()path is now determined by asking the kernel instead of guessing it from cmdline[0].Processuidandgidproperties are deprecated in favor ofuidsandgidsproperties.
Performance
#152, [macOS]:
Process.open_files()rewritten in C (no longer relies onlsof, 3x faster).#153, [macOS]:
Process.connections()rewritten in C (no longer relies onlsof, 3x faster).
Bug fixes
#83, [macOS]:
Process.cmdline()is empty on macOS 64-bit.#130, [Linux]: a race condition can cause
IOErrorexception be raised if process disappears betweenopen()and the subsequentread()call.#145, [Windows]:
WindowsErrorwas raised instead ofAccessDeniedwhen usingProcess.resume()orProcess.suspend().#146, [Linux]:
Process.exe()property can raiseTypeErrorif path contains NULL bytes.#151, [Linux]:
Process.exe()andProcess.cwd()for PID 0 return inconsistent data.
0.2.0 — 2010-11-13¶
New platforms
New APIs
#79: add
Process.open_files().#88: total system physical cached memory, and memory buffers used by the kernel.
#91: add
Process.send_signal()andProcess.terminate()methods.#95:
NoSuchProcessandAccessDeniedexception classes now providepid,nameandmsgattributes.#97: add
Process.children().#103: add
Process.connections().#111: add
Process.exe().#123:
cpu_percent()andProcess.cpu_percent()accept a new interval parameter.#129: add
Process.threads().
API changes
#98:
Process.cpu_times()andProcess.memory_info()now return a named tuple instead of a tuple.#113: exception messages now include
Process.name()andProcess.pid.psutil.Process.pathproperty is deprecated and works as an alias forpsutil.Process.exeproperty.Process.kill(): signal argument was removed - to send a signal to the process useProcess.send_signal()method instead.cpu_times()returns a named tuple instead of a tuple.Process.cpu_percent()andcpu_percent()no longer return immediately by default (see #123).
Performance
#114, [Windows]:
Process.username()rewritten in C (no longer uses WMI, much faster, pywin32 no longer required).
Bug fixes
#81, [Windows], build-fail: psutil fails to compile with Visual Studio.
#86, [FreeBSD], build-fail: psutil didn’t compile against FreeBSD 6.x.
#102, [Windows], memleak: orphaned process handles obtained by using
OpenProcessin C were left behind every timeProcessclass was instantiated.#80: fixed warnings when installing psutil with easy_install.
#94:
Process.suspend()raisesOSErrorinstead ofAccessDenied.#111, [POSIX]:
pathandnameProcessproperties report truncated or erroneous values on POSIX.#120, [macOS]:
cpu_percent()always returning 100%.#112:
uidandgidproperties 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()andProcess.create_time()properties are no longer cached and correctly raiseNoSuchProcessexception if the process disappears.
0.1.3 — 2010-03-02¶
New platforms
New APIs
#51, [Linux], [Windows]: add
Process.cwd().#71: add
Process.suspend()andProcess.resume().
Performance
#59:
Process.is_running()is now 10 times faster.
Bug fixes
#49, [FreeBSD], memleak: possible memory leak due to missing
free()on error condition ingetcmdpath().#62, [Windows], memleak:
Process.cwd()leaked a string object on every call.#36:
Process.cpu_times()andProcess.memory_info()functions succeeded also for dead processes while aNoSuchProcessexception is supposed to be raised.#48, [FreeBSD]: incorrect size for MIB array defined in
getcmdargs.#50, [macOS]: fixed
getcmdargs()memory fragmentation.#55, [Windows]:
test_pid_4was 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 beforeProcess.kill()to make sure we are going to kill the correct process.#73, [macOS]: virtual memory size reported on includes shared library size.
#77:
NoSuchProcesswasn’t raised onProcess.create_time()ifProcess.kill()was used first.
0.1.2 — 2009-05-06¶
New APIs
#32: add
Process.cpu_times().#33: add
Process.create_time().#34: add
Process.cpu_percent().#38: add
Process.memory_info().#41: add
Process.memory_percent().#39: add
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]:
NoSuchProcessnot raised when accessing timing methods.#40, [FreeBSD], [macOS]: fix
test_get_cpu_timesfailures.#42, [Windows]:
Process.memory_percent()raisesAccessDenied.
0.1.1 — 2009-03-06¶
New platforms
#4, [FreeBSD]: support for all functions of psutil.
New APIs
#9, [macOS], [Windows]: add
Process.uidandProcess.gid, returning process UID and GID.#11: per-process parent object:
Process.parent()property returns aProcessobject representing the parent process, andProcess.ppid()returns the parent PID.#21, [Windows]:
AccessDeniedexception created for raising access denied errors fromOSErrororWindowsErroron individual platforms.#26:
process_iter()function to iterate over processes asProcessobjects with a generator.
API changes
#12, #15:
NoSuchProcessexception now raised when creating an object for a nonexistent process, or when retrieving information about a process that has gone away.Processobjects 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()ignoresNoSuchProcessandAccessDeniedexceptions 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]:
Process.kill()for PID 0 now raisesAccessDeniedexception instead ofWindowsError.#30: psutil.get_pid_list() was returning two 0 PIDs.
0.1.0 — 2009-01-27¶
Initial release. Supports Linux, Windows, and macOS via per-platform backends
(_pslinux, _psmswindows, _psosx) with C extensions for Windows and
macOS.
New APIs
Processclass exposingpid,name,path, andcmdline, with akill()method.get_process_list()returning all running processes.ProcessInfovalue object passed between the public API and the platform backends.