[WINDOWS] Reorganise CPU stats display #2131

This commit is contained in:
nicolargo 2022-09-18 14:29:11 +02:00
parent acb50b70a1
commit 99554d99a4
4 changed files with 31 additions and 16 deletions

View File

@ -15,25 +15,29 @@
<div class="table-cell text-left">system:</div>
<div class="table-cell" :class="getDecoration('system')">{{ system }}%</div>
</div>
<div class="table-row">
<div class="table-cell text-left">idle:</div>
<div class="table-cell">{{ idle }}%</div>
<div class="table-row" v-show="iowait != undefined">
<div class="table-cell text-left">iowait:</div>
<div class="table-cell" :class="getDecoration('iowait')">{{ iowait }}%</div>
</div>
<div class="table-row" v-show="iowait == undefined && dcp != undefined">
<div class="table-cell text-left">dcp:</div>
<div class="table-cell" :class="getDecoration('dpc')">{{ dpc }}%</div>
</div>
</div>
</div>
<div class="hidden-xs hidden-sm col-md-12 col-lg-8">
<div class="table">
<div class="table-row" v-show="nice != undefined">
<div class="table-cell text-left">nice:</div>
<div class="table-cell">{{ nice }}%</div>
<div class="table-row">
<div class="table-cell text-left">idle:</div>
<div class="table-cell">{{ idle }}%</div>
</div>
<div class="table-row" v-show="irq != undefined">
<div class="table-cell text-left">irq:</div>
<div class="table-cell">{{ irq }}%</div>
</div>
<div class="table-row" v-show="iowait != undefined">
<div class="table-cell text-left">iowait:</div>
<div class="table-cell" :class="getDecoration('iowait')">{{ iowait }}%</div>
<div class="table-row" v-show="nice != undefined">
<div class="table-cell text-left">nice:</div>
<div class="table-cell">{{ nice }}%</div>
</div>
<div class="table-row" v-show="steal != undefined">
<div class="table-cell text-left">steal:</div>
@ -55,7 +59,7 @@
{{ interrupts }}
</div>
</div>
<div class="table-row" v-if="soft_interrupts">
<div class="table-row" v-if="!isWindows && !isSunOS && soft_interrupts">
<div class="table-cell text-left">sw_int:</div>
<div class="table-cell">
{{ soft_interrupts }}
@ -90,6 +94,12 @@ export default {
isLinux() {
return this.data.isLinux;
},
isSunOS() {
return this.data.isSunOS;
},
isWindows() {
return this.data.isWindows;
},
total() {
return this.stats.total;
},
@ -111,6 +121,9 @@ export default {
iowait() {
return this.stats.iowait;
},
dpc() {
return this.stats.dpc;
},
steal() {
return this.stats.steal;
},

View File

@ -64,6 +64,7 @@ class GlancesStatsService {
views: response[1],
isBsd: response[0]['system']['os_name'] === 'FreeBSD',
isLinux: response[0]['system']['os_name'] === 'Linux',
isSunOS: response[0]['system']['os_name'] === 'SunOS',
isMac: response[0]['system']['os_name'] === 'Darwin',
isWindows: response[0]['system']['os_name'] === 'Windows'
};

File diff suppressed because one or more lines are too long

View File

@ -12,7 +12,7 @@
from glances.timer import getTimeSinceLastUpdate
from glances.compat import iterkeys
from glances.cpu_percent import cpu_percent
from glances.globals import LINUX
from glances.globals import LINUX, WINDOWS, SUNOS
from glances.plugins.glances_core import Plugin as CorePlugin
from glances.plugins.glances_plugin import GlancesPlugin
@ -367,7 +367,8 @@ class Plugin(GlancesPlugin):
# Nice CPU
ret.extend(self.curse_add_stat('nice', width=14, header=' '))
# soft_interrupts
ret.extend(self.curse_add_stat('soft_interrupts', width=15, header=' '))
if not WINDOWS and not SUNOS:
ret.extend(self.curse_add_stat('soft_interrupts', width=15, header=' '))
# Fourth line
# iowait + steal + syscalls