summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicolargo <nicolas@nicolargo.com>2022-12-28 10:57:29 +0100
committernicolargo <nicolas@nicolargo.com>2022-12-28 10:57:29 +0100
commitd6bdb8dd8e5be7495f842a480ee88aaedf04078e (patch)
tree3ccfb9d6513cb1dba3d2af57370ff6c8837300de
parent9614e2bb19c6bdd512fea5dafbed1250da0049d9 (diff)
Before bar for threads
-rw-r--r--glances/outputs/glances_curses.py2
-rw-r--r--glances/plugins/glances_processlist.py31
2 files changed, 24 insertions, 9 deletions
diff --git a/glances/outputs/glances_curses.py b/glances/outputs/glances_curses.py
index 02796aa6..a81192c6 100644
--- a/glances/outputs/glances_curses.py
+++ b/glances/outputs/glances_curses.py
@@ -429,7 +429,7 @@ class _GlancesCurses(object):
elif self.pressedkey == ord('-'):
# '+' > Decrease process nice level
self.decrease_nice_process = not self.decrease_nice_process
- elif self.pressedkey == ord('k'):
+ elif self.pressedkey == ord('k') and not self.args.disable_cursor:
# 'k' > Kill selected process (after confirmation)
self.kill_process = not self.kill_process
elif self.pressedkey == ord('w'):
diff --git a/glances/plugins/glances_processlist.py b/glances/plugins/glances_processlist.py
index a7417e3c..66a62f32 100644
--- a/glances/plugins/glances_processlist.py
+++ b/glances/plugins/glances_processlist.py
@@ -483,8 +483,11 @@ class Plugin(GlancesPlugin):
return ret
def __msg_curse_extended_process(self, ret, p):
- """Get extended curses data tfor the selected process (see issue #2225)
- p: the process dict
+ """Get extended curses data for the selected process (see issue #2225)
+
+ The result depends of the process type (process or thread).
+
+ Input p is a dict with the following keys:
{'status': 'S',
'memory_info': pmem(rss=466890752, vms=3365347328, shared=68153344, text=659456, lib=0, data=774647808, dirty=0),
'pid': 4980,
@@ -501,9 +504,22 @@ class Plugin(GlancesPlugin):
'cmdline': ['/snap/firefox/2154/usr/lib/firefox/firefox', '-contentproc', '-childID', '...'],
'username': 'nicolargo'}
"""
+ if self.args.programs:
+ self.__msg_curse_extended_process_program(ret, p)
+ else:
+ self.__msg_curse_extended_process_thread(ret, p)
+
+ def __msg_curse_extended_process_program(self, ret, p):
+ # Title
+ msg = "Pinned program {} ('e' to unpin)".format(p['name'])
+ ret.append(self.curse_add_line(msg, "TITLE"))
+
+ ret.append(self.curse_new_line())
+ ret.append(self.curse_new_line())
+
+ def __msg_curse_extended_process_thread(self, ret, p):
# Title
- msg = 'Selected {} {}'.format('program' if self.args.programs else 'thread',
- p['name'])
+ msg = "Pinned thread {} ('e' to unpin)".format(p['name'])
ret.append(self.curse_add_line(msg, "TITLE"))
# First line is CPU affinity
@@ -617,10 +633,9 @@ class Plugin(GlancesPlugin):
msg, sort_style if process_sort_key == 'io_counters' else 'DEFAULT', optional=True, additional=True
)
)
- if not self.args.programs:
- msg = self.layout_header['command'].format('Command', "('k' to kill)" if args.is_standalone else "")
- else:
- msg = self.layout_header['command'].format('Programs', "('k' to kill)" if args.is_standalone else "")
+ shortkey = "('e' to pin | 'k' to kill)" if args.is_standalone and not args.disable_cursor else ""
+ msg = self.layout_header['command'].format("Programs" if self.args.programs else "Command",
+ shortkey)
ret.append(self.curse_add_line(msg, sort_style if process_sort_key == 'name' else 'DEFAULT'))
def __msg_curse_sum(self, ret, sep_char='_', mmm=None, args=None):