public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Marcelo Tosatti <mtosatti@redhat.com>, kvm@vger.kernel.org
Subject: [PATCH 4/6] kvm_stat: sort tui output according to highest occurence
Date: Tue, 31 Aug 2010 16:25:30 +0300	[thread overview]
Message-ID: <1283261132-5904-6-git-send-email-avi@redhat.com> (raw)
In-Reply-To: <1283261132-5904-1-git-send-email-avi@redhat.com>

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@redhat.com>
---
 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


  parent reply	other threads:[~2010-08-31 13:25 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-31 13:25 [PATCH 0/6] kvm_stat tracepoint support Avi Kivity
2010-08-31 13:25 ` [PATCH 0/6] *** SUBJECT HERE *** Avi Kivity
2010-08-31 13:30   ` Avi Kivity
2010-08-31 14:43     ` Gerd Hoffmann
2010-08-31 16:10       ` Avi Kivity
2010-08-31 16:13         ` Anthony Liguori
2010-08-31 16:24           ` Avi Kivity
2010-09-01  7:32           ` Gerd Hoffmann
2010-08-31 13:25 ` [PATCH 1/6] kvm_stat: refactor to separate stats provider from difference engine Avi Kivity
2010-08-31 13:25 ` [PATCH 2/6] kvm_stat: implement tracepoint stats provider Avi Kivity
2010-08-31 13:25 ` [PATCH 3/6] kvm_stat: provide detailed kvm_exit:exit_reason display Avi Kivity
2010-08-31 13:25 ` Avi Kivity [this message]
2010-08-31 13:25 ` [PATCH 5/6] kvm_stat: increase label width Avi Kivity
2010-08-31 13:25 ` [PATCH 6/6] kvm_stat: be slower Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1283261132-5904-6-git-send-email-avi@redhat.com \
    --to=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox