1
1
mirror of https://github.com/nicolargo/glances.git synced 2024-12-29 12:12:53 +03:00

[WINDOWS] Reorganise CPU stats display

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
glances
outputs/static
plugins

View File

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

View File

@ -64,6 +64,7 @@ class GlancesStatsService {
views: response[1], views: response[1],
isBsd: response[0]['system']['os_name'] === 'FreeBSD', isBsd: response[0]['system']['os_name'] === 'FreeBSD',
isLinux: response[0]['system']['os_name'] === 'Linux', isLinux: response[0]['system']['os_name'] === 'Linux',
isSunOS: response[0]['system']['os_name'] === 'SunOS',
isMac: response[0]['system']['os_name'] === 'Darwin', isMac: response[0]['system']['os_name'] === 'Darwin',
isWindows: response[0]['system']['os_name'] === 'Windows' 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.timer import getTimeSinceLastUpdate
from glances.compat import iterkeys from glances.compat import iterkeys
from glances.cpu_percent import cpu_percent 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_core import Plugin as CorePlugin
from glances.plugins.glances_plugin import GlancesPlugin from glances.plugins.glances_plugin import GlancesPlugin
@ -367,6 +367,7 @@ class Plugin(GlancesPlugin):
# Nice CPU # Nice CPU
ret.extend(self.curse_add_stat('nice', width=14, header=' ')) ret.extend(self.curse_add_stat('nice', width=14, header=' '))
# soft_interrupts # soft_interrupts
if not WINDOWS and not SUNOS:
ret.extend(self.curse_add_stat('soft_interrupts', width=15, header=' ')) ret.extend(self.curse_add_stat('soft_interrupts', width=15, header=' '))
# Fourth line # Fourth line