Display load as percentage when Irix mode is disable #1554

This commit is contained in:
nicolargo 2019-11-06 09:15:09 +01:00
parent cc856941a8
commit 043e574626
5 changed files with 28 additions and 27 deletions

BIN
docs/_static/loadpercent.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

@ -25,6 +25,12 @@ Thresholds are computed by dividing the 5 and 15 minutes average load per
CPU(s) number. For example, if you have 4 CPUs and the 5 minutes load is
1.0, then the warning threshold will be set to 2.8 (0.7 * 4 * 1.0).
From Glances 3.1.4, if Irix/Solaris mode is off ('0' key), the value is
divided by logical core number and multiple by 100 to have load as a
percentage.
.. image:: ../_static/loadpercent.png
Legend:
============= ============

View File

@ -46,8 +46,8 @@ Columns display
========================= ==============================================
``CPU%`` % of CPU used by the process
If Irix/Solaris mode is off, the value is
divided by logical core number
If Irix/Solaris mode is off ('0' key), the value
is divided by logical core number
``MEM%`` % of MEM used by the process (RES divided by
the total RAM you have)
``VIRT`` Virtual Memory Size

View File

@ -1,6 +1,6 @@
.\" Man page generated from reStructuredText.
.
.TH "GLANCES" "1" "Nov 02, 2019" "3.1.4_BETA" "Glances"
.TH "GLANCES" "1" "Nov 06, 2019" "3.1.4_BETA" "Glances"
.SH NAME
glances \- An eye on your system
.

View File

@ -142,34 +142,29 @@ class Plugin(GlancesPlugin):
# Build the string message
# Header
msg = '{:8}'.format('LOAD')
msg = '{:8}'.format('LOAD%' if (args.disable_irix and self.nb_log_core != 0) else 'LOAD')
ret.append(self.curse_add_line(msg, "TITLE"))
# Core number
if 'cpucore' in self.stats and self.stats['cpucore'] > 0:
msg = '{}-core'.format(int(self.stats['cpucore']))
ret.append(self.curse_add_line(msg))
# New line
ret.append(self.curse_new_line())
# 1min load
msg = '{:8}'.format('1 min:')
ret.append(self.curse_add_line(msg))
msg = '{:>6.2f}'.format(self.stats['min1'])
ret.append(self.curse_add_line(msg))
# New line
ret.append(self.curse_new_line())
# 5min load
msg = '{:8}'.format('5 min:')
ret.append(self.curse_add_line(msg))
msg = '{:>6.2f}'.format(self.stats['min5'])
ret.append(self.curse_add_line(
msg, self.get_views(key='min5', option='decoration')))
# New line
ret.append(self.curse_new_line())
# 15min load
msg = '{:8}'.format('15 min:')
ret.append(self.curse_add_line(msg))
msg = '{:>6.2f}'.format(self.stats['min15'])
ret.append(self.curse_add_line(
msg, self.get_views(key='min15', option='decoration')))
# Loop over 1min, 5min and 15min load
for load_time in ['1', '5', '15']:
ret.append(self.curse_new_line())
msg = '{:8}'.format('{} min:'.format(load_time))
ret.append(self.curse_add_line(msg))
if args.disable_irix and self.nb_log_core != 0:
# Enable Irix mode for load (see issue #1554)
load_stat = self.stats['min{}'.format(load_time)] / self.nb_log_core * 100
else:
load_stat = self.stats['min{}'.format(load_time)]
msg = '{:>6.2f}'.format(load_stat)
if load_time == '1':
ret.append(self.curse_add_line(msg))
else:
# Alert is only for 5 and 15 min
ret.append(self.curse_add_line(
msg, self.get_views(key='min{}'.format(load_time),
option='decoration')))
return ret