Merge pull request #674 from notFloran/fix-percpu-when-no-iowait

Fix percpu when stats are missing
This commit is contained in:
Nicolas Hennion
2015-09-13 11:44:34 +02:00
2 changed files with 5 additions and 2 deletions

View File

@@ -19,13 +19,13 @@
<div class="table-cell text-left">idle:</div>
<div class="table-cell" ng-repeat="percpu in statsPerCpu.cpus">{{ percpu.idle }}%</div>
</div>
<div class="table-row">
<div class="table-row" ng-show="statsPerCpu.cpus[0].iowait">
<div class="table-cell text-left">iowait:</div>
<div class="table-cell" ng-repeat="percpu in statsPerCpu.cpus" ng-class="statsPerCpu.getSystemAlert(percpu)">
{{ percpu.iowait }}%
</div>
</div>
<div class="table-row">
<div class="table-row" ng-show="statsPerCpu.cpus[0].steal">
<div class="table-cell text-left">steal:</div>
<div class="table-cell" ng-repeat="percpu in statsPerCpu.cpus" ng-class="statsPerCpu.getSystemAlert(percpu)">
{{ percpu.steal }}%

View File

@@ -95,6 +95,9 @@ class Plugin(GlancesPlugin):
# Stats per-CPU
for stat in ['user', 'system', 'idle', 'iowait', 'steal']:
if not stat in self.stats[0]:
continue
ret.append(self.curse_new_line())
msg = '{0:8}'.format(stat + ':')
ret.append(self.curse_add_line(msg))