mirror of
https://github.com/nicolargo/glances.git
synced 2024-09-11 12:47:14 +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).
|
||||||
|
|
||||||
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
|
Additionally, if you want to use your own glances.conf file, you can
|
||||||
create your own Dockerfile:
|
create your own Dockerfile:
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ class CpuPercent:
|
|||||||
|
|
||||||
def __get_cpu_name(self):
|
def __get_cpu_name(self):
|
||||||
# Get the CPU name once from the /proc/cpuinfo file
|
# 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
|
ret = None
|
||||||
try:
|
try:
|
||||||
cpuinfo_file = open('/proc/cpuinfo').readlines()
|
cpuinfo_file = open('/proc/cpuinfo').readlines()
|
||||||
@ -73,7 +73,7 @@ class CpuPercent:
|
|||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
for line in cpuinfo_file:
|
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()
|
ret = line.split(':')[1].strip()
|
||||||
break
|
break
|
||||||
return ret if ret else 'CPU'
|
return ret if ret else 'CPU'
|
||||||
|
@ -370,7 +370,7 @@ class _GlancesCurses:
|
|||||||
logger.info(f"Stop Glances (keypressed: {self.pressedkey})")
|
logger.info(f"Stop Glances (keypressed: {self.pressedkey})")
|
||||||
|
|
||||||
def _handle_refresh(self):
|
def _handle_refresh(self):
|
||||||
pass
|
glances_processes.reset_internal_cache()
|
||||||
|
|
||||||
def loop_position(self):
|
def loop_position(self):
|
||||||
"""Return the current sort in the loop"""
|
"""Return the current sort in the loop"""
|
||||||
|
@ -119,6 +119,14 @@ class GlancesProcesses:
|
|||||||
"""Set args."""
|
"""Set args."""
|
||||||
self.args = 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):
|
def reset_processcount(self):
|
||||||
"""Reset the global process count"""
|
"""Reset the global process count"""
|
||||||
self.processcount = {'total': 0, 'running': 0, 'sleeping': 0, 'thread': 0, 'pid_max': None}
|
self.processcount = {'total': 0, 'running': 0, 'sleeping': 0, 'thread': 0, 'pid_max': None}
|
||||||
@ -445,7 +453,9 @@ class GlancesProcesses:
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
# Only get the info key
|
# 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
|
# Sort the processes list by the current sort_key
|
||||||
processlist = sort_stats(processlist, sorted_by=self.sort_key, reverse=True)
|
processlist = sort_stats(processlist, sorted_by=self.sort_key, reverse=True)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user