summaryrefslogtreecommitdiff
path: root/psutil/_pslinux.py
Commit message (Collapse)AuthorAgeFilesLines
* Linux, cpu_freq(): diminish os.stat() calls a bitGiampaolo Rodola2020-12-301-12/+5
| | | | | | | | | | Micro optimization in reference to #1852 and #1851. Use glob.glob(), which internally relies on os.scandir() in order to list /sys/devices/system/cpu/cpufreq files. In doing so, we avoid os.path.exists() for each CPU, which internally uses os.stat(). Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
* Rename cpu_count_physical() to cpu_count_cores()Giampaolo Rodola2020-12-211-2/+2
| | | | | | | | | | This has always been cause of confusion, e.g. see: https://github.com/giampaolo/psutil/pull/1727#issuecomment-698934643 Removed the reference to "physical" from dostrings, functions and test. I still left it in the doc though, as it's more explanatory. Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
* Don't duplicate coretemp sensor readings (#1822)Tim Schlueter2020-12-171-2/+12
| | | Fixes giampaolo/psutil#1708
* [macOS, UNIX] prefer _SC_PAGESIZE over (partially) deprecated getpagesize() ↵Giampaolo Rodola2020-12-171-1/+1
| | | | | | | | | | | | | | | (#1891) Add a reusable `psutil_getpagesize()` utility common to all UNIXes. Related to #1885 (`getpagesize()` is deprecated on recent macOS, POSIX.1-2001 and possibly other UNIXes). The problem emerged on macOS but `getpagesize()` is also used in FreeBSD, NetBSD, OpenBSD and AIX, so it makes sense to do this in one place only, similarly to Windows which also provide a `psutil_getpagesize()` utility. Follow cPython's `mmapmodule.c` and `resourcemodule.c` lead and rely on `sysconf(_SC_PAGESIZE)` instead, but leave `getpagesize()` in place as last resort/attempt for systems where it's not deprecated and/or they still legitimately rely on it. Also provide a python wrapper so we can test the return value of this C function against Python's stdlib modules. Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
* remove misleading "in UTC" (#1882)zed2020-11-151-1/+1
| | | | | | | | | | | | | | | | | "seconds since the epoch" (value returned by `time.time()`) doesn't depend on the local time zone. It is the same time instance around the world. It is not in any particular time zone: ```python import datetime as DT import zoneinfo local_time = DT.datetime.fromtimestamp(seconds_since_epoch) # naive datetime object representing local time utc_time = DT.datetime.utcfromtimestamp(seconds_since_epoch) # naive datetime object representing utc time la_time = DT.datetime.fromtimestamp(seconds_since_epoch, zoneinfo.ZoneInfo("America/Los_Angeles")) # timezone aware dt ``` Here `local_time`, `utc_time`, `la_time` may correspond to different clock times but it is exactly the same time instance.
* Rewrite Linux prlimit() with ctypes (Linux wheels) (#1879)Giampaolo Rodola2020-11-151-6/+52
|
* revert last commitGiampaolo Rodola2020-11-011-9/+2
|
* fix #1868: missing fields from /proc/pid/stat on Alpine LinuxGiampaolo Rodola2020-11-011-2/+9
|
* disk_partitions() maxfile and maxpath (#1863)Giampaolo Rodola2020-10-241-1/+3
|
* [FreeBSD] process resource limits (#1859) (#809)Giampaolo Rodola2020-10-231-6/+0
|
* linux / cpu_count phys: take depreated */thread_siblings_list intoGiampaolo Rodola2020-10-171-9/+15
| | | | | | | | | | | | account /sys/devices/system/cpu/cpu[0-9]*/topology/thread_siblings_list is deprecated /sys/devices/system/cpu/cpu[0-9]*/topology/core_cpus_list is the new name also add test which makes sure method 1 and 2 return the same result
* Merge branch 'master' of github.com:giampaolo/psutilGiampaolo Rodola2020-10-171-4/+4
|\
| * Fix cpu_count_physical() returning wrong values on systems with SMT or more ↵Vincent A. Arcila2020-10-171-4/+4
| | | | | | | | than one processor (#1727)
* | increase test coverageGiampaolo Rodola2020-10-171-1/+1
|/
* remove old unused code (#1843)Arnon Yaari2020-10-051-4/+0
| | | Co-authored-by: Arnon Yaari <arnony@infinidat.com>
* sensors_battery() only return None if percentage is undetermined (#1838)aristocratos2020-09-301-3/+2
|
* Expanded battery sensor detection (#1837)aristocratos2020-09-271-4/+11
|
* update doc for #1830 (net_if_stats() isup check if NIC is running)Giampaolo Rodola2020-09-211-1/+1
|
* Backport python 3 super() (#1733)Giampaolo Rodola2020-04-241-1/+1
|
* Remove useless assignment (#1728)kaiix2020-04-161-1/+0
|
* Fix handling /proc/cpuinfo without tabs (#1726)Michał Górny2020-04-141-1/+1
| | | | | | | /proc/cpuinfo uses spaces rather than tabs on ia64. Since there seems not to be any reason to require specific kind of whitespace before ':' on 'cpu mhz' line, just split on ':'. See: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/ia64/kernel/setup.c#n700
* #1681, revert 00a3398Giampaolo Rodola2020-02-131-25/+0
|
* small refactoring to accomodate #1691Giampaolo Rodola2020-02-131-5/+6
|
* fix #1627: [Linux] Process.memory_maps() can raise KeyErrorGiampaolo Rodola2020-02-111-1/+1
|
* small refactGiampaolo Rodola2020-02-111-3/+2
|
* fix #1681 / linux / disk_partitions: show swapGiampaolo Rodola2020-02-111-0/+27
|
* [Linux] disk_io_counters() ValueError when parsing /sys/block (#1684)Giampaolo Rodola2020-02-091-1/+1
| | | | | | | | | | | | | | | | | | | Fixes: ``` ====================================================================== ERROR: psutil.tests.test_linux.TestSystemDiskIoCounters.test_emulate_use_sysfs ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/giampaolo/svn/psutil/psutil/tests/test_linux.py", line 1195, in test_emulate_use_sysfs wsysfs = psutil.disk_io_counters(perdisk=True) File "/home/giampaolo/svn/psutil/psutil/__init__.py", line 2065, in disk_io_counters rawdict = _psplatform.disk_io_counters(**kwargs) File "/home/giampaolo/svn/psutil/psutil/_pslinux.py", line 1124, in disk_io_counters for entry in gen: File "/home/giampaolo/svn/psutil/psutil/_pslinux.py", line 1110, in read_sysfs wbytes, wtime, _, busy_time, _) = map(int, fields) ValueError: too many values to unpack (expected 11) ```
* fix #1650 [Linux] sensors_temperatures() no longer emit warnings on file not ↵Giampaolo Rodola2020-02-091-2/+2
| | | | found (print debug msg instead)
* Properly handle PID type in C (#1672)Giampaolo Rodola2020-01-291-3/+1
|
* Future-proof disk_io_counters on Linux. (#1665)Mike Hommey2020-01-171-1/+2
| | | | | | | | | | Kernel 5.5 added 2 more fields to /proc/diskstats, requiring another change after the one for 4.18, which recently added 4 fields. At this point in time, the meaning of the existing fields is unlikely to change, and psutil is not using any of the newer ones. By considering 18 fields and more to have the current layout, psutil will continue to work as newer kernels add more fields.
* move custom exceptions in _common.pyGiampaolo Rodola2020-01-021-7/+3
|
* lintGiampaolo Rodola2019-12-281-1/+2
|
* sensors_temperatures: also search /sys/devices/platform/coretemp.* for ↵Javad Karabi2019-12-281-0/+1
| | | | temperatures (#1648)
* updat HISTORYGiampaolo Rodola2019-11-221-3/+2
|
* linux, cmdline(), fix for #1179, comment 552984549: sometimes string ends ↵Giampaolo Rodola2019-11-221-1/+8
| | | | with null byte but args are separated by spaces
* fix #1126: cpu_affinity() segfaults on CentOS 5Giampaolo Rodola2019-10-101-30/+34
| | | | | | Remove cpu_affinity() support for CentOS 5 (it's 8 years old anyway); remove the dual implementation. Recent manylinux versions should use CentOS 6.
* fix #1527: Linux process CPU iowait timeGiampaolo Rodola2019-09-071-1/+7
|
* PEP-3151: backport FS exceptions to Python 2 (#1544)Giampaolo Rodola2019-06-281-65/+50
|
* Connection family/type are not converted to enums (#1535)Giampaolo Rodola2019-06-141-1/+1
|
* Revert "Add handling of missing space in meminfo output (#1517)" (#1531)Giampaolo Rodola2019-06-121-3/+2
| | | This reverts commit 6b994c625db2abaaadf58a0425f9daaf3e4ad9e5.
* Add handling of missing space in meminfo output (#1517)xiaclo2019-06-121-2/+3
|
* small refactoringGiampaolo Rodola2019-05-141-1/+1
|
* remove catching IOError; let the test fail and adjust it laterGiampaolo Rodola2019-04-261-11/+5
|
* Fix cpu freq (#1496)David Brochart2019-04-261-5/+17
|
* fix #1493: [Linux] cpu_freq(): handle the case where ↵Giampaolo Rodola2019-04-261-1/+1
| | | | /sys/devices/system/cpu/cpufreq/ exists but is empty.
* Revert "Fix cpu_freq (#1493)" (#1495)Giampaolo Rodola2019-04-251-7/+1
| | | This reverts commit 01e00a6629a78a7277aac627c8b025cb753d6fee.
* Fix cpu_freq (#1493)David Brochart2019-04-251-1/+7
|
* Update cpu_freq to return 0 for max/min if not available (#1487)Alex Manuskin2019-04-251-1/+1
|
* refactor/move some utilities into _common.pyGiampaolo Rodola2019-04-121-15/+2
|
* Linux / CPU freq, fixes #1481Alex Manuskin2019-04-051-15/+11
|