[PATCH 4/6] kvm_stat: sort tui output according to highest occurence

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



With plenty of counters and wide, short screens it's hard to see what's on
the top.  So sort the output.

Signed-off-by: Avi Kivity <avi@xxxxxxxxxx>
---
 kvm/kvm_stat |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/kvm/kvm_stat b/kvm/kvm_stat
index 677683a..c55bf88 100755
--- a/kvm/kvm_stat
+++ b/kvm/kvm_stat
@@ -306,7 +306,12 @@ def tui(screen, stats):
         screen.addstr(0, 0, 'kvm statistics')
         row = 2
         s = stats.get()
-        for key in sorted(s.keys()):
+        def sortkey(x):
+            if s[x][1]:
+                return -s[x][1]
+            else:
+                return x
+        for key in sorted(s.keys(), key = sortkey):
             if row >= screen.getmaxyx()[0]:
                 break
             values = s[key]
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux