mirror of
https://github.com/nicolargo/glances.git
synced 2024-08-17 00:10:48 +03:00
Compare commits
8 Commits
05a126d1d6
...
650633c1b5
Author | SHA1 | Date | |
---|---|---|---|
|
650633c1b5 | ||
|
036eb976e9 | ||
|
2c5a1150bd | ||
|
f6066e5d46 | ||
|
cff2e9fc4a | ||
|
e5d5351d31 | ||
|
be89ee0025 | ||
|
1e2e36af23 |
@ -221,8 +221,6 @@ Run last version of Glances container in *console mode*:
|
||||
|
||||
By default, the /etc/glances/glances.conf file is used (based on docker-compose/glances.conf).
|
||||
|
||||
By default, the /etc/glances/glances.conf file is used (based on docker-compose/glances.conf).
|
||||
|
||||
Additionally, if you want to use your own glances.conf file, you can
|
||||
create your own Dockerfile:
|
||||
|
||||
|
@ -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'
|
||||
|
@ -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"""
|
||||
|
@ -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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user