Skip to content

Commit

Permalink
Merge branch 'issue1554' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolargo committed Nov 6, 2019
2 parents cc85694 + 043e574 commit 4be7c63
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 27 deletions.
Binary file added docs/_static/loadpercent.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions docs/aoa/load.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:

============= ============
Expand Down
4 changes: 2 additions & 2 deletions docs/aoa/ps.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/man/glances.1
Original file line number Diff line number Diff line change
@@ -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
.
Expand Down
43 changes: 19 additions & 24 deletions glances/plugins/glances_load.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,34 +142,29 @@ def msg_curse(self, args=None, max_width=None):

# 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

0 comments on commit 4be7c63

Please sign in to comment.