mirror of
https://github.com/nicolargo/glances.git
synced 2024-12-26 10:42:29 +03:00
Add IOps in the DiskIO plugin (issue #763)
This commit is contained in:
parent
73bcd657eb
commit
16a62781e4
@ -206,6 +206,8 @@ Start the client browser (browser mode):\n\
|
||||
dest='byte', help='display network rate in byte per second')
|
||||
parser.add_argument('--diskio-show-ramfs', action='store_true', default=False,
|
||||
dest='diskio_show_ramfs', help='show RAM Fs in the DiskIO plugin')
|
||||
parser.add_argument('--diskio-iops', action='store_true', default=False,
|
||||
dest='diskio_iops', help='show IO per second in the DiskIO plugin')
|
||||
parser.add_argument('--fahrenheit', action='store_true', default=False,
|
||||
dest='fahrenheit', help='display temperature in Fahrenheit (default is Celsius)')
|
||||
parser.add_argument('-1', '--percpu', action='store_true', default=False,
|
||||
|
@ -314,8 +314,10 @@ class _GlancesCurses(object):
|
||||
glances_processes.sort_key = 'cpu_percent'
|
||||
elif self.pressedkey == ord('b'):
|
||||
# 'b' > Switch between bit/s and Byte/s for network IO
|
||||
# self.net_byteps_tag = not self.net_byteps_tag
|
||||
self.args.byte = not self.args.byte
|
||||
elif self.pressedkey == ord('B'):
|
||||
# 'B' > Switch between bit/s and IO/s for Disk IO
|
||||
self.args.diskio_iops = not self.args.diskio_iops
|
||||
elif self.pressedkey == ord('c'):
|
||||
# 'c' > Sort processes by CPU usage
|
||||
glances_processes.auto_sort = False
|
||||
|
@ -102,8 +102,12 @@ class Plugin(GlancesPlugin):
|
||||
if self.is_hide(disk):
|
||||
continue
|
||||
|
||||
# Compute bitrate
|
||||
# Compute count and bit rate
|
||||
try:
|
||||
read_count = (diskio_new[disk].read_count -
|
||||
self.diskio_old[disk].read_count)
|
||||
write_count = (diskio_new[disk].write_count -
|
||||
self.diskio_old[disk].write_count)
|
||||
read_bytes = (diskio_new[disk].read_bytes -
|
||||
self.diskio_old[disk].read_bytes)
|
||||
write_bytes = (diskio_new[disk].write_bytes -
|
||||
@ -111,6 +115,8 @@ class Plugin(GlancesPlugin):
|
||||
diskstat = {
|
||||
'time_since_update': time_since_update,
|
||||
'disk_name': disk,
|
||||
'read_count': read_count,
|
||||
'write_count': write_count,
|
||||
'read_bytes': read_bytes,
|
||||
'write_bytes': write_bytes}
|
||||
except KeyError:
|
||||
@ -161,6 +167,12 @@ class Plugin(GlancesPlugin):
|
||||
# Header
|
||||
msg = '{0:9}'.format('DISK I/O')
|
||||
ret.append(self.curse_add_line(msg, "TITLE"))
|
||||
if args.diskio_iops:
|
||||
msg = '{0:>7}'.format('IOR/s')
|
||||
ret.append(self.curse_add_line(msg))
|
||||
msg = '{0:>7}'.format('IOW/s')
|
||||
ret.append(self.curse_add_line(msg))
|
||||
else:
|
||||
msg = '{0:>7}'.format('R/s')
|
||||
ret.append(self.curse_add_line(msg))
|
||||
msg = '{0:>7}'.format('W/s')
|
||||
@ -179,6 +191,24 @@ class Plugin(GlancesPlugin):
|
||||
disk_name = '_' + disk_name[-8:]
|
||||
msg = '{0:9}'.format(disk_name)
|
||||
ret.append(self.curse_add_line(msg))
|
||||
if args.diskio_iops:
|
||||
# count
|
||||
txps = self.auto_unit(
|
||||
int(i['read_count'] // i['time_since_update']))
|
||||
rxps = self.auto_unit(
|
||||
int(i['write_count'] // i['time_since_update']))
|
||||
msg = '{0:>7}'.format(txps)
|
||||
ret.append(self.curse_add_line(msg,
|
||||
self.get_views(item=i[self.get_key()],
|
||||
key='read_count',
|
||||
option='decoration')))
|
||||
msg = '{0:>7}'.format(rxps)
|
||||
ret.append(self.curse_add_line(msg,
|
||||
self.get_views(item=i[self.get_key()],
|
||||
key='write_count',
|
||||
option='decoration')))
|
||||
else:
|
||||
# Bitrate
|
||||
txps = self.auto_unit(
|
||||
int(i['read_bytes'] // i['time_since_update']))
|
||||
rxps = self.auto_unit(
|
||||
|
@ -91,6 +91,7 @@ class Plugin(GlancesPlugin):
|
||||
self.view_data['enable_disable_docker'] = msg_col2.format('D', 'Enable/disable Docker stats')
|
||||
self.view_data['enable_disable_quick_look'] = msg_col.format('3', 'Enable/disable quick look plugin')
|
||||
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['edit_pattern_filter'] = 'ENTER: Edit the process filter pattern'
|
||||
|
||||
def get_view_data(self, args=None):
|
||||
@ -156,13 +157,14 @@ class Plugin(GlancesPlugin):
|
||||
ret.append(self.curse_add_line(self.view_data['show_hide_help']))
|
||||
ret.append(self.curse_new_line())
|
||||
ret.append(self.curse_add_line(self.view_data['enable_disable_quick_look']))
|
||||
ret.append(self.curse_add_line(self.view_data['quit']))
|
||||
ret.append(self.curse_add_line(self.view_data['diskio_iops']))
|
||||
ret.append(self.curse_new_line())
|
||||
ret.append(self.curse_add_line(self.view_data['enable_disable_top_extends_stats']))
|
||||
ret.append(self.curse_new_line())
|
||||
ret.append(self.curse_add_line(self.view_data['enable_disable_short_processname']))
|
||||
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_new_line())
|
||||
|
@ -456,9 +456,9 @@ class Plugin(GlancesPlugin):
|
||||
ret.append(self.curse_add_line(msg))
|
||||
msg = '{0:>10}'.format('TIME+')
|
||||
ret.append(self.curse_add_line(msg, sort_style if process_sort_key == 'cpu_times' else 'DEFAULT', optional=True))
|
||||
msg = '{0:>6}'.format('IOR/s')
|
||||
msg = '{0:>6}'.format('R/s')
|
||||
ret.append(self.curse_add_line(msg, sort_style if process_sort_key == 'io_counters' else 'DEFAULT', optional=True, additional=True))
|
||||
msg = '{0:>6}'.format('IOW/s')
|
||||
msg = '{0:>6}'.format('W/s')
|
||||
ret.append(self.curse_add_line(msg, sort_style if process_sort_key == 'io_counters' else 'DEFAULT', optional=True, additional=True))
|
||||
msg = ' {0:8}'.format('Command')
|
||||
ret.append(self.curse_add_line(msg, sort_style if process_sort_key == 'name' else 'DEFAULT'))
|
||||
|
Loading…
Reference in New Issue
Block a user