iotop/SOURCES/iotop-0.6-git9c49d59.patch
2022-05-10 10:31:38 +00:00

64 lines
2.7 KiB
Diff

diff -up iotop-0.6/iotop/ui.py.git9c49d59 iotop-0.6/iotop/ui.py
--- iotop-0.6/iotop/ui.py.git9c49d59 2022-02-15 21:35:33.983889767 +0100
+++ iotop-0.6/iotop/ui.py 2022-02-15 21:39:22.508839448 +0100
@@ -184,6 +184,12 @@ class IOTopUI(object):
self.sorting_key += delta
self.sorting_key = max(0, self.sorting_key)
self.sorting_key = min(len(IOTopUI.sorting_keys) - 1, self.sorting_key)
+ if not self.has_swapin_io:
+ if self.sorting_key in (5, 6):
+ if delta <= 0:
+ self.sorting_key = 4
+ elif delta > 0:
+ self.sorting_key = 7
if orig_sorting_key != self.sorting_key:
self.sorting_reverse = IOTopUI.sorting_keys[self.sorting_key][1]
@@ -377,14 +383,22 @@ class IOTopUI(object):
def format(p):
stats = format_stats(self.options, p, self.process_list.duration)
io_delay, swapin_delay, read_bytes, write_bytes = stats
+ format = '%%%dd' % MAX_PID_WIDTH
+ params = p.pid,
+ format += ' %4s'
+ params += p.get_ioprio(),
+ format += ' %-8s'
+ params += p.get_user()[:8],
+ format += ' %11s %11s'
+ params += read_bytes, write_bytes
if self.has_swapin_io:
- delay_stats = '%7s %7s ' % (swapin_delay, io_delay)
- else:
- delay_stats = ' ?unavailable? '
- pid_format = '%%%dd' % MAX_PID_WIDTH
- line = (pid_format + ' %4s %-8s %11s %11s %s') % (
- p.pid, p.get_ioprio(), p.get_user()[:8], read_bytes,
- write_bytes, delay_stats)
+ format += ' %7s %7s'
+ params += swapin_delay, io_delay
+ elif self.options.batch:
+ format += ' %s '
+ params += '?unavailable?',
+ format += ' '
+ line = format % (params)
cmdline = p.get_cmdline()
if not self.options.batch:
remaining_length = self.width - len(line)
@@ -439,6 +453,7 @@ class IOTopUI(object):
# and iotop then uses the sysctl value instead.
if sysctl_task_delayacct() == False:
self.has_swapin_io = False
+ self.adjust_sorting_key(0)
lines = self.get_data()
if self.options.time:
titles = [' TIME'] + titles
@@ -462,6 +477,8 @@ class IOTopUI(object):
self.width)
remaining_cols = self.width
for i in range(len(titles)):
+ if not self.has_swapin_io and i in (5, 6):
+ continue
attr = curses.A_REVERSE
title = titles[i]
if i == self.sorting_key: