Commit 1fdea7b2 authored by Stefan Raspl's avatar Stefan Raspl Committed by Paolo Bonzini

tools/kvm_stat: add new interactive command 'h'

Display interactive commands reference on 'h'.
While at it, sort interactive commands alphabetically in various places.
Signed-off-by: default avatarStefan Raspl <raspl@linux.vnet.ibm.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 38e89c37
...@@ -1018,6 +1018,30 @@ class Tui(object): ...@@ -1018,6 +1018,30 @@ class Tui(object):
self.screen.addstr(4, 1, 'No matching events reported yet') self.screen.addstr(4, 1, 'No matching events reported yet')
self.screen.refresh() self.screen.refresh()
def show_help_interactive(self):
"""Display help with list of interactive commands"""
msg = (' c clear filter',
' f filter by regular expression',
' g filter by guest name',
' h display interactive commands reference',
' p filter by PID',
' q quit',
' r reset stats',
' x toggle reporting of stats for individual child trace'
' events',
'Any other key refreshes statistics immediately')
curses.cbreak()
self.screen.erase()
self.screen.addstr(0, 0, "Interactive commands reference",
curses.A_BOLD)
self.screen.addstr(2, 0, "Press any key to exit", curses.A_STANDOUT)
row = 4
for line in msg:
self.screen.addstr(row, 0, line)
row += 1
self.screen.getkey()
self.refresh_header()
def show_filter_selection(self): def show_filter_selection(self):
"""Draws filter selection mask. """Draws filter selection mask.
...@@ -1142,10 +1166,6 @@ class Tui(object): ...@@ -1142,10 +1166,6 @@ class Tui(object):
sleeptime = DELAY_REGULAR sleeptime = DELAY_REGULAR
try: try:
char = self.screen.getkey() char = self.screen.getkey()
if char == 'x':
self.update_drilldown()
if char == 'q':
break
if char == 'c': if char == 'c':
self.stats.fields_filter = DEFAULT_REGEX self.stats.fields_filter = DEFAULT_REGEX
self.refresh_header(0) self.refresh_header(0)
...@@ -1160,13 +1180,19 @@ class Tui(object): ...@@ -1160,13 +1180,19 @@ class Tui(object):
self.show_vm_selection_by_guest_name() self.show_vm_selection_by_guest_name()
curses.curs_set(0) curses.curs_set(0)
sleeptime = DELAY_INITIAL sleeptime = DELAY_INITIAL
if char == 'h':
self.show_help_interactive()
if char == 'p': if char == 'p':
curses.curs_set(1) curses.curs_set(1)
self.show_vm_selection_by_pid() self.show_vm_selection_by_pid()
curses.curs_set(0) curses.curs_set(0)
sleeptime = DELAY_INITIAL sleeptime = DELAY_INITIAL
if char == 'q':
break
if char == 'r': if char == 'r':
self.stats.reset() self.stats.reset()
if char == 'x':
self.update_drilldown()
except KeyboardInterrupt: except KeyboardInterrupt:
break break
except curses.error: except curses.error:
...@@ -1237,10 +1263,11 @@ Interactive Commands: ...@@ -1237,10 +1263,11 @@ Interactive Commands:
c clear filter c clear filter
f filter by regular expression f filter by regular expression
g filter by guest name g filter by guest name
h display interactive commands reference
p filter by PID p filter by PID
q quit q quit
x toggle reporting of stats for individual child trace events
r reset stats r reset stats
x toggle reporting of stats for individual child trace events
Press any other key to refresh statistics immediately. Press any other key to refresh statistics immediately.
""" """
......
...@@ -35,6 +35,8 @@ INTERACTIVE COMMANDS ...@@ -35,6 +35,8 @@ INTERACTIVE COMMANDS
*g*:: filter by guest name *g*:: filter by guest name
*h*:: display interactive commands reference
*p*:: filter by PID *p*:: filter by PID
*q*:: quit *q*:: quit
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment