Compare commits

...

7 Commits

Author SHA1 Message Date
Nicolas Hennion
3e034c9bd3
Merge afc66f2dcd into f6066e5d46 2024-06-27 03:05:06 +02:00
nicolargo
f6066e5d46 PsUtil 6+ no longer check PID reused #2755 2024-06-26 18:56:31 +02:00
nicolargo
cff2e9fc4a Call process_iter.clear_cache() (PsUtil 6+) when Glances user force a refresh (F5 or CTRL-R) #2753 2024-06-26 18:36:10 +02:00
nicolargo
e5d5351d31 Add cpu model for CPU info (Raspberry PI 5) 2024-06-26 18:12:56 +02:00
nicolargo
be89ee0025 Merge remote-tracking branch 'origin/2616-raspberry-pi-cpu-info-is-not-correct' into develop 2024-06-26 18:10:00 +02:00
Bharath Vignesh J K
1e2e36af23 chg: cpu_percent - support CPU Name for Raspberry Pi
fixes #2616
2024-06-22 02:32:20 +05:30
snyk-bot
afc66f2dcd
fix: doc-requirements.txt to reduce vulnerabilities
The following vulnerabilities are fixed by pinning transitive dependencies:
- https://snyk.io/vuln/SNYK-PYTHON-URLLIB3-7267250
2024-06-19 03:00:35 +00:00
4 changed files with 15 additions and 4 deletions

View File

@ -5,3 +5,4 @@ reuse
setuptools>=65.5.1 # not directly required, pinned by Snyk to avoid a vulnerability
sphinx
sphinx_rtd_theme
urllib3>=2.2.2 # not directly required, pinned by Snyk to avoid a vulnerability

View File

@ -65,7 +65,7 @@ class CpuPercent:
def __get_cpu_name(self):
# Get the CPU name once from the /proc/cpuinfo file
# Read the first line with the "model name"
# Read the first line with the "model name" ("Model" for Raspberry Pi)
ret = None
try:
cpuinfo_file = open('/proc/cpuinfo').readlines()
@ -73,7 +73,7 @@ class CpuPercent:
pass
else:
for line in cpuinfo_file:
if line.startswith('model name'):
if line.startswith('model name') or line.startswith('Model') or line.startswith('cpu model'):
ret = line.split(':')[1].strip()
break
return ret if ret else 'CPU'

View File

@ -370,7 +370,7 @@ class _GlancesCurses:
logger.info(f"Stop Glances (keypressed: {self.pressedkey})")
def _handle_refresh(self):
pass
glances_processes.reset_internal_cache()
def loop_position(self):
"""Return the current sort in the loop"""

View File

@ -119,6 +119,14 @@ class GlancesProcesses:
"""Set args."""
self.args = args
def reset_internal_cache(self):
"""Reset the internal cache."""
self.cache_timer = Timer(0)
self.processlist_cache = {}
if hasattr(psutil.process_iter, 'cache_clear'):
# Cache clear only available in PsUtil 6 or higher
psutil.process_iter.cache_clear()
def reset_processcount(self):
"""Reset the global process count"""
self.processcount = {'total': 0, 'running': 0, 'sleeping': 0, 'thread': 0, 'pid_max': None}
@ -445,7 +453,9 @@ class GlancesProcesses:
)
)
# Only get the info key
processlist = [p.info for p in processlist]
# PsUtil 6+ no longer check PID reused #2755 so use is_running in the loop
# Note: not sure it is realy needed but CPU consumption look teh same with or without it
processlist = [p.info for p in processlist if p.is_running()]
# Sort the processes list by the current sort_key
processlist = sort_stats(processlist, sorted_by=self.sort_key, reverse=True)