python-psutil/mem-used-bsc1181475.patch

35 lines
1.2 KiB
Diff
Raw Normal View History

- update to 6.1.0: * 2366_, [Windows]: drastically speedup `process_iter()`_. We now determine process unique identity by using process "fast" create time method. This will considerably speedup those apps which use `process_iter()`_ only once, e.g. to look for a process with a certain name. * 2446_: use pytest instead of unittest. * 2448_: add make install-sysdeps target to install the necessary system dependencies (python-dev, gcc, etc.) on all supported UNIX flavors. * 2449_: add make install-pydeps-test and make install-pydeps- dev targets. They can be used to install dependencies meant for running tests and for local development. They can also be installed via pip install .[test] and pip install .[dev]. * 2456_: allow to run tests via python3 -m psutil.tests even if pytest module is not installed. This is useful for production environments that don't have pytest installed, but still want to be able to test psutil installation. * 2427_: psutil (segfault) on import in the free-threaded (no GIL) version of Python 3.13. (patch by Sam Gross) * 2455_, [Linux]: IndexError may occur when reading /proc/pid/stat and field 40 (blkio_ticks) is missing. * 2457_, [AIX]: significantly improve the speed of `Process.open_files()`_ for some edge cases. * 2460_, [OpenBSD]: `Process.num_fds()`_ and `Process.open_files()`_ may fail with `NoSuchProcess`_ for PID 0. Instead, we now return "null" values (0 and [] respectively). - drop skip_failing_tests.patch: obsolete OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-psutil?expand=0&rev=175
2024-11-20 16:23:42 +00:00
---
psutil/_pslinux.py | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
Index: psutil-5.9.5/psutil/_pslinux.py
===================================================================
--- psutil-5.9.5.orig/psutil/_pslinux.py
+++ psutil-5.9.5/psutil/_pslinux.py
@@ -474,12 +474,6 @@ def virtual_memory():
except KeyError:
slab = 0
- used = total - free - cached - buffers
- if used < 0:
- # May be symptomatic of running within a LCX container where such
- # values will be dramatically distorted over those of the host.
- used = total - free
-
# - starting from 4.4.0 we match free's "available" column.
# Before 4.4.0 we calculated it as (free + buffers + cached)
# which matched htop.
@@ -510,6 +504,12 @@ def virtual_memory():
# 24fd2605c51fccc375ab0287cec33aa767f06718/proc/sysinfo.c#L764
avail = free
+ used = total - avail
+ if used < 0:
+ # May be symptomatic of running within a LCX container where such
+ # values will be dramatically distorted over those of the host.
+ used = total - free
+
percent = usage_percent((total - avail), total, round_=1)
# Warn about missing metrics which are set to 0.