summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicolargo <nicolas@nicolargo.com>2019-11-06 09:15:09 +0100
committernicolargo <nicolas@nicolargo.com>2019-11-06 09:15:09 +0100
commit043e5746269e91398f40396dc08c6b7df66192f8 (patch)
tree6c0a94f555f1391f9567489ee831d43f2c3b9da0
parentcc856941a836c3ff5df73f5abed7b55e01be573d (diff)
Display load as percentage when Irix mode is disable #1554
-rw-r--r--docs/_static/loadpercent.pngbin0 -> 6889 bytes
-rw-r--r--docs/aoa/load.rst6
-rw-r--r--docs/aoa/ps.rst4
-rw-r--r--docs/man/glances.12
-rw-r--r--glances/plugins/glances_load.py43
5 files changed, 28 insertions, 27 deletions
diff --git a/docs/_static/loadpercent.png b/docs/_static/loadpercent.png
new file mode 100644
index 00000000..7d3e4875
--- /dev/null
+++ b/docs/_static/loadpercent.png
Binary files differ
diff --git a/docs/aoa/load.rst b/docs/aoa/load.rst
index ef1827ab..08374abb 100644
--- a/docs/aoa/load.rst
+++ b/docs/aoa/load.rst
@@ -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:
============= ============
diff --git a/docs/aoa/ps.rst b/docs/aoa/ps.rst
index d96da721..14906147 100644
--- a/docs/aoa/ps.rst
+++ b/docs/aoa/ps.rst
@@ -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
diff --git a/docs/man/glances.1 b/docs/man/glances.1
index efefe0a9..cd9a9882 100644
--- a/docs/man/glances.1
+++ b/docs/man/glances.1
@@ -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
.
diff --git a/glances/plugins/glances_load.py b/glances/plugins/glances_load.py
index 69b0bbfd..891a7eb9 100644
--- a/glances/plugins/glances_load.py
+++ b/glances/plugins/glances_load.py
@@ -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