|
|
9bac43 |
From 8654f68785c5ddddfd92b8fd2b0e550481e3099c Mon Sep 17 00:00:00 2001
|
|
|
9bac43 |
From: David Hildenbrand <david@redhat.com>
|
|
|
9bac43 |
Date: Tue, 17 Oct 2017 19:15:30 +0200
|
|
|
9bac43 |
Subject: [PATCH 25/69] tools/kvm_stat: fix misc glitches
|
|
|
9bac43 |
MIME-Version: 1.0
|
|
|
9bac43 |
Content-Type: text/plain; charset=UTF-8
|
|
|
9bac43 |
Content-Transfer-Encoding: 8bit
|
|
|
9bac43 |
|
|
|
9bac43 |
RH-Author: David Hildenbrand <david@redhat.com>
|
|
|
9bac43 |
Message-id: <20171017191605.2378-5-david@redhat.com>
|
|
|
9bac43 |
Patchwork-id: 77313
|
|
|
9bac43 |
O-Subject: [RHEL-7.5 qemu-kvm-rhev PATCH 04/39] tools/kvm_stat: fix misc glitches
|
|
|
9bac43 |
Bugzilla: 1497137
|
|
|
9bac43 |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9bac43 |
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
|
|
|
9bac43 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9bac43 |
RH-Acked-by: Thomas Huth <thuth@redhat.com>
|
|
|
9bac43 |
|
|
|
9bac43 |
Upstream-status: linux.git e0ba38765c1d1d670246d6f6c518594aa8e62587
|
|
|
9bac43 |
|
|
|
9bac43 |
commit e0ba38765c1d1d670246d6f6c518594aa8e62587
|
|
|
9bac43 |
Author: Stefan Raspl <raspl@linux.vnet.ibm.com>
|
|
|
9bac43 |
Date: Fri Mar 10 13:40:03 2017 +0100
|
|
|
9bac43 |
|
|
|
9bac43 |
tools/kvm_stat: fix misc glitches
|
|
|
9bac43 |
|
|
|
9bac43 |
Addresses
|
|
|
9bac43 |
- eliminate extra import
|
|
|
9bac43 |
- missing variable initialization
|
|
|
9bac43 |
- type redefinition from int to float
|
|
|
9bac43 |
- passing of int type argument instead of string
|
|
|
9bac43 |
- a couple of PEP8-reported indentation/formatting glitches
|
|
|
9bac43 |
- remove unused variable drilldown in class Tui
|
|
|
9bac43 |
|
|
|
9bac43 |
Signed-off-by: Stefan Raspl <raspl@linux.vnet.ibm.com>
|
|
|
9bac43 |
Reviewed-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
|
|
|
9bac43 |
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
|
|
|
9bac43 |
|
|
|
9bac43 |
Signed-off-by: David Hildenbrand <david@redhat.com>
|
|
|
9bac43 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9bac43 |
---
|
|
|
9bac43 |
scripts/kvm/kvm_stat | 24 +++++++++++-------------
|
|
|
9bac43 |
1 file changed, 11 insertions(+), 13 deletions(-)
|
|
|
9bac43 |
|
|
|
9bac43 |
diff --git a/scripts/kvm/kvm_stat b/scripts/kvm/kvm_stat
|
|
|
9bac43 |
index 14536c0..231186a 100755
|
|
|
9bac43 |
--- a/scripts/kvm/kvm_stat
|
|
|
9bac43 |
+++ b/scripts/kvm/kvm_stat
|
|
|
9bac43 |
@@ -31,7 +31,6 @@ import resource
|
|
|
9bac43 |
import struct
|
|
|
9bac43 |
import re
|
|
|
9bac43 |
from collections import defaultdict
|
|
|
9bac43 |
-from time import sleep
|
|
|
9bac43 |
|
|
|
9bac43 |
VMX_EXIT_REASONS = {
|
|
|
9bac43 |
'EXCEPTION_NMI': 0,
|
|
|
9bac43 |
@@ -657,6 +656,7 @@ class DebugfsProvider(object):
|
|
|
9bac43 |
self._fields = self.get_available_fields()
|
|
|
9bac43 |
self._pid = 0
|
|
|
9bac43 |
self.do_read = True
|
|
|
9bac43 |
+ self.paths = []
|
|
|
9bac43 |
|
|
|
9bac43 |
def get_available_fields(self):
|
|
|
9bac43 |
""""Returns a list of available fields.
|
|
|
9bac43 |
@@ -794,7 +794,6 @@ class Tui(object):
|
|
|
9bac43 |
def __init__(self, stats):
|
|
|
9bac43 |
self.stats = stats
|
|
|
9bac43 |
self.screen = None
|
|
|
9bac43 |
- self.drilldown = False
|
|
|
9bac43 |
self.update_drilldown()
|
|
|
9bac43 |
|
|
|
9bac43 |
def __enter__(self):
|
|
|
9bac43 |
@@ -950,11 +949,10 @@ class Tui(object):
|
|
|
9bac43 |
while True:
|
|
|
9bac43 |
self.refresh(sleeptime)
|
|
|
9bac43 |
curses.halfdelay(int(sleeptime * 10))
|
|
|
9bac43 |
- sleeptime = 3
|
|
|
9bac43 |
+ sleeptime = 3.0
|
|
|
9bac43 |
try:
|
|
|
9bac43 |
char = self.screen.getkey()
|
|
|
9bac43 |
if char == 'x':
|
|
|
9bac43 |
- self.drilldown = not self.drilldown
|
|
|
9bac43 |
self.update_drilldown()
|
|
|
9bac43 |
if char == 'q':
|
|
|
9bac43 |
break
|
|
|
9bac43 |
@@ -1064,12 +1062,12 @@ Requirements:
|
|
|
9bac43 |
help='fields to display (regex)',
|
|
|
9bac43 |
)
|
|
|
9bac43 |
optparser.add_option('-p', '--pid',
|
|
|
9bac43 |
- action='store',
|
|
|
9bac43 |
- default=0,
|
|
|
9bac43 |
- type=int,
|
|
|
9bac43 |
- dest='pid',
|
|
|
9bac43 |
- help='restrict statistics to pid',
|
|
|
9bac43 |
- )
|
|
|
9bac43 |
+ action='store',
|
|
|
9bac43 |
+ default=0,
|
|
|
9bac43 |
+ type='int',
|
|
|
9bac43 |
+ dest='pid',
|
|
|
9bac43 |
+ help='restrict statistics to pid',
|
|
|
9bac43 |
+ )
|
|
|
9bac43 |
(options, _) = optparser.parse_args(sys.argv)
|
|
|
9bac43 |
return options
|
|
|
9bac43 |
|
|
|
9bac43 |
@@ -1099,8 +1097,8 @@ def check_access(options):
|
|
|
9bac43 |
"Also ensure, that the kvm modules are loaded.\n")
|
|
|
9bac43 |
sys.exit(1)
|
|
|
9bac43 |
|
|
|
9bac43 |
- if not os.path.exists(PATH_DEBUGFS_TRACING) and (options.tracepoints
|
|
|
9bac43 |
- or not options.debugfs):
|
|
|
9bac43 |
+ if not os.path.exists(PATH_DEBUGFS_TRACING) and (options.tracepoints or
|
|
|
9bac43 |
+ not options.debugfs):
|
|
|
9bac43 |
sys.stderr.write("Please enable CONFIG_TRACING in your kernel "
|
|
|
9bac43 |
"when using the option -t (default).\n"
|
|
|
9bac43 |
"If it is enabled, make {0} readable by the "
|
|
|
9bac43 |
@@ -1111,7 +1109,7 @@ def check_access(options):
|
|
|
9bac43 |
|
|
|
9bac43 |
sys.stderr.write("Falling back to debugfs statistics!\n")
|
|
|
9bac43 |
options.debugfs = True
|
|
|
9bac43 |
- sleep(5)
|
|
|
9bac43 |
+ time.sleep(5)
|
|
|
9bac43 |
|
|
|
9bac43 |
return options
|
|
|
9bac43 |
|
|
|
9bac43 |
--
|
|
|
9bac43 |
1.8.3.1
|
|
|
9bac43 |
|