[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 39/49] scripts/kvm/kvm_stat: Add interactive filterin
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 39/49] scripts/kvm/kvm_stat: Add interactive filtering |
Date: |
Tue, 26 Jan 2016 14:47:11 +0100 |
From: Janosch Frank <address@hidden>
Interactively changing the filter is much more useful than the
drilldown, because it is more versatile.
With this patch, the filter can be changed by pressing 'f' in the text
ui and entering a new filter regex.
Signed-off-by: Janosch Frank <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
scripts/kvm/kvm_stat | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/scripts/kvm/kvm_stat b/scripts/kvm/kvm_stat
index eb97a65..25631a4 100755
--- a/scripts/kvm/kvm_stat
+++ b/scripts/kvm/kvm_stat
@@ -634,6 +634,28 @@ class Tui(object):
row += 1
self.screen.refresh()
+ def show_filter_selection(self):
+ while True:
+ self.screen.erase()
+ self.screen.addstr(0, 0,
+ "Show statistics for events matching a regex.",
+ curses.A_BOLD)
+ self.screen.addstr(2, 0,
+ "Current regex: {0}"
+ .format(self.stats.fields_filter))
+ self.screen.addstr(3, 0, "New regex: ")
+ curses.echo()
+ regex = self.screen.getstr()
+ curses.noecho()
+ if len(regex) == 0:
+ return
+ try:
+ re.compile(regex)
+ self.stats.fields_filter = regex
+ return
+ except re.error:
+ continue
+
def show_stats(self):
sleeptime = 0.25
while True:
@@ -647,6 +669,8 @@ class Tui(object):
self.update_drilldown()
if char == 'q':
break
+ if char == 'f':
+ self.show_filter_selection()
except KeyboardInterrupt:
break
except curses.error:
--
1.8.3.1
- [Qemu-devel] [PULL 36/49] scripts/kvm/kvm_stat: Read event values as u64, (continued)
- [Qemu-devel] [PULL 36/49] scripts/kvm/kvm_stat: Read event values as u64, Paolo Bonzini, 2016/01/26
- [Qemu-devel] [PULL 31/49] scripts/kvm/kvm_stat: Group arch specific data, Paolo Bonzini, 2016/01/26
- [Qemu-devel] [PULL 34/49] scripts/kvm/kvm_stat: Fix output formatting, Paolo Bonzini, 2016/01/26
- [Qemu-devel] [PULL 33/49] scripts/kvm/kvm_stat: Make tui function a class, Paolo Bonzini, 2016/01/26
- [Qemu-devel] [PULL 37/49] scripts/kvm/kvm_stat: Fix rlimit for unprivileged users, Paolo Bonzini, 2016/01/26
- [Qemu-devel] [PULL 38/49] scripts/kvm/kvm_stat: Fixup filtering, Paolo Bonzini, 2016/01/26
- [Qemu-devel] [PULL 32/49] scripts/kvm/kvm_stat: Remove unneeded X86_EXIT_REASONS, Paolo Bonzini, 2016/01/26
- [Qemu-devel] [PULL 35/49] scripts/kvm/kvm_stat: Cleanup and pre-init perf_event_attr, Paolo Bonzini, 2016/01/26
- [Qemu-devel] [PULL 40/49] scripts/kvm/kvm_stat: Add optparse description, Paolo Bonzini, 2016/01/26
- [Qemu-devel] [PULL 41/49] cpus: use broadcast on qemu_pause_cond, Paolo Bonzini, 2016/01/26
- [Qemu-devel] [PULL 39/49] scripts/kvm/kvm_stat: Add interactive filtering,
Paolo Bonzini <=
- [Qemu-devel] [PULL 43/49] nbd: add missed aio_context_acquire in nbd_export_new, Paolo Bonzini, 2016/01/26
- [Qemu-devel] [PULL 42/49] memory: exit when hugepage allocation fails if mem-prealloc, Paolo Bonzini, 2016/01/26
- [Qemu-devel] [PULL 45/49] scripts/dump-guest-memory.py: Make methods functions, Paolo Bonzini, 2016/01/26
- [Qemu-devel] [PULL 46/49] scripts/dump-guest-memory.py: Improve python 3 compatibility, Paolo Bonzini, 2016/01/26
- [Qemu-devel] [PULL 47/49] scripts/dump-guest-memory.py: Cleanup functions, Paolo Bonzini, 2016/01/26
- [Qemu-devel] [PULL 44/49] scripts/dump-guest-memory.py: Move constants to the top, Paolo Bonzini, 2016/01/26
- [Qemu-devel] [PULL 48/49] scripts/dump-guest-memory.py: Introduce multi-arch support, Paolo Bonzini, 2016/01/26
- [Qemu-devel] [PULL 49/49] scripts/dump-guest-memory.py: Fix module docstring, Paolo Bonzini, 2016/01/26
- Re: [Qemu-devel] [PULL 00/49] chardev, NBD, cpus, scripts/ changes for 2015-01-26, Peter Maydell, 2016/01/26