mirror of
https://github.com/nicolargo/glances.git
synced 2024-12-25 02:02:32 +03:00
improved aligment of UI and indentation of Python code
This commit is contained in:
parent
5ae130e386
commit
8b0247e97f
@ -1,8 +1,10 @@
|
||||
<div class="table-row">
|
||||
<div class="table-cell text-left title">IRQ</div>
|
||||
<div class="table-cell"></div>
|
||||
<div class="table-cell">Rate/s</div>
|
||||
</div>
|
||||
<div class="table-row" ng-repeat="irq in statsIrq.irqs">
|
||||
<div class="table-cell text-left">{{irq.irq_line}}</div>
|
||||
<div class="table-cell">{{irq.irq_rate}}</div>
|
||||
<div class="table-cell"></div>
|
||||
<div class="table-cell"><span>{{irq.irq_rate}}</span></div>
|
||||
</div>
|
||||
|
@ -49,10 +49,9 @@
|
||||
<section id="ports" class="plugin table-row-group" ng-show="!arguments.disable_ports" ng-include src="'plugins/ports.html'"></section>
|
||||
<section id="diskio" class="plugin table-row-group" ng-show="!arguments.disable_diskio && statsDiskio.disks.length > 0" ng-include src="'plugins/diskio.html'"></section>
|
||||
|
||||
<section id="irq" class="plugin table-row-group" ng-show="!arguments.disable_irq" ng-include src="'plugins/irq.html'"></section>
|
||||
|
||||
<section id="fs" class="plugin table-row-group" ng-show="!arguments.disable_fs" ng-include src="'plugins/fs.html'"></section>
|
||||
<section id="folders" class="plugin table-row-group" ng-show="!arguments.disable_fs && statsFolders.folders.length > 0" ng-include src="'plugins/folders.html'"></section>
|
||||
<section id="irq" class="plugin table-row-group" ng-show="!arguments.disable_irq" ng-include src="'plugins/irq.html'"></section>
|
||||
<section id="folders" class="plugin table-row-group" ng-show="!arguments.disable_fs && statsFolders.folders.length > 0" ng-include src="'plugins/folders.html'"></section>
|
||||
<section id="raid" class="plugin table-row-group" ng-show="statsRaid.hasDisks()" ng-include src="'plugins/raid.html'"></section>
|
||||
<section id="sensors" class="plugin table-row-group" ng-show="!arguments.disable_sensors && statsSensors.sensors.length > 0" ng-include src="'plugins/sensors.html'"></section>
|
||||
</div>
|
||||
|
@ -50,16 +50,16 @@ class Plugin(GlancesPlugin):
|
||||
pass
|
||||
|
||||
def generate_view_data(self):
|
||||
self.view_data['version'] = '{} {}'.format(__appname__.title(), __version__)
|
||||
self.view_data['psutil_version'] = ' with PSutil {}'.format(psutil_version)
|
||||
self.view_data['version'] = '{0} {1}'.format(__appname__.title(), __version__)
|
||||
self.view_data['psutil_version'] = ' with PSutil {0}'.format(psutil_version)
|
||||
|
||||
try:
|
||||
self.view_data['configuration_file'] = 'Configuration file: {}'.format(self.config.loaded_config_file)
|
||||
self.view_data['configuration_file'] = 'Configuration file: {0}'.format(self.config.loaded_config_file)
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
msg_col = ' {:1} {:35}'
|
||||
msg_col2 = ' {:1} {:35}'
|
||||
msg_col = ' {0:1} {1:35}'
|
||||
msg_col2 = ' {0:1} {1:35}'
|
||||
self.view_data['sort_auto'] = msg_col.format('a', 'Sort processes automatically')
|
||||
self.view_data['sort_network'] = msg_col2.format('b', 'Bytes or bits for network I/O')
|
||||
self.view_data['sort_cpu'] = msg_col.format('c', 'Sort processes by CPU%')
|
||||
@ -74,8 +74,8 @@ class Plugin(GlancesPlugin):
|
||||
self.view_data['sort_cpu_times'] = msg_col.format('t', 'Sort processes by TIME')
|
||||
self.view_data['show_hide_help'] = msg_col2.format('h', 'Show/hide this help screen')
|
||||
self.view_data['show_hide_diskio'] = msg_col.format('d', 'Show/hide disk I/O stats')
|
||||
self.view_data['show_hide_irq'] = msg_col2.format('R', 'Show/hide IRQ stats')
|
||||
self.view_data['view_network_io_combination'] = msg_col2.format('T', 'View network I/O as combination')
|
||||
self.view_data['show_hide_irq'] = msg_col2.format('R', 'Show/hide IRQ stats')
|
||||
self.view_data['view_network_io_combination'] = msg_col2.format('T', 'View network I/O as combination')
|
||||
self.view_data['show_hide_filesystem'] = msg_col.format('f', 'Show/hide filesystem stats')
|
||||
self.view_data['view_cumulative_network'] = msg_col2.format('U', 'View cumulative network I/O')
|
||||
self.view_data['show_hide_network'] = msg_col.format('n', 'Show/hide network stats')
|
||||
@ -94,8 +94,6 @@ class Plugin(GlancesPlugin):
|
||||
self.view_data['show_hide_ip'] = msg_col2.format('I', 'Show/hide IP module')
|
||||
self.view_data['diskio_iops'] = msg_col2.format('B', 'Count/rate for Disk I/O')
|
||||
self.view_data['show_hide_top_menu'] = msg_col2.format('5', 'Show/hide top menu (QL, CPU, MEM, SWAP and LOAD)')
|
||||
self.view_data['show_hide_amp'] = msg_col2.format('A', 'Show/hide AMP plugin')
|
||||
self.view_data['enable_disable_ports'] = msg_col.format('P', 'Enable/disable ports plugin')
|
||||
self.view_data['edit_pattern_filter'] = 'ENTER: Edit the process filter pattern'
|
||||
|
||||
def get_view_data(self, args=None):
|
||||
@ -167,14 +165,11 @@ class Plugin(GlancesPlugin):
|
||||
ret.append(self.curse_add_line(self.view_data['show_hide_top_menu']))
|
||||
ret.append(self.curse_new_line())
|
||||
ret.append(self.curse_add_line(self.view_data['enable_disable_short_processname']))
|
||||
ret.append(self.curse_add_line(self.view_data['show_hide_amp']))
|
||||
ret.append(self.curse_add_line(self.view_data['show_hide_irq']))
|
||||
ret.append(self.curse_new_line())
|
||||
ret.append(self.curse_add_line(self.view_data['enable_disable_irix']))
|
||||
ret.append(self.curse_add_line(self.view_data['quit']))
|
||||
ret.append(self.curse_new_line())
|
||||
ret.append(self.curse_add_line(self.view_data['enable_disable_ports']))
|
||||
ret.append(self.curse_add_line(self.view_data['show_hide_irq']))
|
||||
ret.append(self.curse_new_line())
|
||||
|
||||
ret.append(self.curse_new_line())
|
||||
|
||||
|
@ -38,7 +38,7 @@ class Plugin(GlancesPlugin):
|
||||
# We want to display the stat in the curse interface
|
||||
self.display_curse = True
|
||||
|
||||
self.lasts = {}
|
||||
self.lasts = {}
|
||||
|
||||
# Init the stats
|
||||
self.reset()
|
||||
@ -58,40 +58,44 @@ class Plugin(GlancesPlugin):
|
||||
# Reset the list
|
||||
self.reset()
|
||||
|
||||
if self.input_method == 'local':
|
||||
with open('/proc/interrupts') as irq_proc:
|
||||
time_since_update = getTimeSinceLastUpdate('irq')
|
||||
irq_proc.readline() # skip header line
|
||||
for irq_line in irq_proc.readlines():
|
||||
splitted_line = irq_line.split()
|
||||
irq_line = splitted_line[0].replace(':','')
|
||||
current_irqs = sum([int(count) for count in splitted_line[1:] if count.isdigit()]) # sum interrupts on all CPUs
|
||||
irq_rate = int(current_irqs - self.lasts.get(irq_line) if self.lasts.get(irq_line) else 0 // time_since_update)
|
||||
irq_current = {
|
||||
'irq_line': irq_line,
|
||||
'irq_rate': irq_rate,
|
||||
'key': self.get_key(),
|
||||
'time_since_update': time_since_update
|
||||
}
|
||||
self.stats.append(irq_current)
|
||||
self.lasts[irq_line] = current_irqs
|
||||
if self.input_method == 'local':
|
||||
with open('/proc/interrupts') as irq_proc:
|
||||
time_since_update = getTimeSinceLastUpdate('irq')
|
||||
irq_proc.readline() # skip header line
|
||||
for irq_line in irq_proc.readlines():
|
||||
splitted_line = irq_line.split()
|
||||
irq_line = splitted_line[0].replace(':', '')
|
||||
current_irqs = sum([int(count) for count in splitted_line[
|
||||
1:] if count.isdigit()]) # sum interrupts on all CPUs
|
||||
irq_rate = int(
|
||||
current_irqs -
|
||||
self.lasts.get(irq_line) if self.lasts.get(irq_line) else 0 //
|
||||
time_since_update)
|
||||
irq_current = {
|
||||
'irq_line': irq_line,
|
||||
'irq_rate': irq_rate,
|
||||
'key': self.get_key(),
|
||||
'time_since_update': time_since_update
|
||||
}
|
||||
self.stats.append(irq_current)
|
||||
self.lasts[irq_line] = current_irqs
|
||||
|
||||
elif self.input_method == 'snmp':
|
||||
# not available
|
||||
pass
|
||||
elif self.input_method == 'snmp':
|
||||
# not available
|
||||
pass
|
||||
|
||||
# Update the view
|
||||
self.update_views()
|
||||
|
||||
self.stats = sorted(self.stats, key=operator.itemgetter('irq_rate'), reverse=True)[:5] # top 5 IRQ by rate/s
|
||||
return self.stats
|
||||
self.stats = sorted(self.stats, key=operator.itemgetter(
|
||||
'irq_rate'), reverse=True)[:5] # top 5 IRQ by rate/s
|
||||
return self.stats
|
||||
|
||||
def update_views(self):
|
||||
"""Update stats views."""
|
||||
# Call the father's method
|
||||
super(Plugin, self).update_views()
|
||||
|
||||
|
||||
def msg_curse(self, args=None, max_width=None):
|
||||
"""Return the dict to display in the curse interface."""
|
||||
# Init the return message
|
||||
@ -110,14 +114,14 @@ class Plugin(GlancesPlugin):
|
||||
# Header
|
||||
msg = '{:{width}}'.format('IRQ', width=irq_max_width)
|
||||
ret.append(self.curse_add_line(msg, "TITLE"))
|
||||
msg = '{:>7}'.format('Rate/s')
|
||||
msg = '{:>14}'.format('Rate/s')
|
||||
ret.append(self.curse_add_line(msg))
|
||||
|
||||
for i in self.stats:
|
||||
ret.append(self.curse_new_line())
|
||||
msg = '{:>3}'.format(i['irq_line'])
|
||||
ret.append(self.curse_add_line(msg))
|
||||
msg = '{:>12}'.format(str(i['irq_rate']))
|
||||
msg = '{:>20}'.format(str(i['irq_rate']))
|
||||
ret.append(self.curse_add_line(msg))
|
||||
|
||||
return ret
|
||||
|
@ -176,7 +176,7 @@ class TestGlances(unittest.TestCase):
|
||||
self.assertIsInstance(req['cpu'], dict)
|
||||
|
||||
def test_012_irq(self):
|
||||
"""IRQS"""
|
||||
"""IRQS"""
|
||||
method = "getIrqs()"
|
||||
print('INFO: [TEST_012] Method: %s' % method)
|
||||
req = json.loads(client.getIrq())
|
||||
|
Loading…
Reference in New Issue
Block a user