aboutsummaryrefslogtreecommitdiff
path: root/scripts/kvm
diff options
context:
space:
mode:
authorJanosch Frank <frankja@linux.vnet.ibm.com>2016-01-11 16:17:42 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2016-01-26 15:58:12 +0100
commitf4109dba216f2df61a6098fdd7a6f2d2be4ac848 (patch)
tree3fd6ab1dc27459c802d65d2ef9b261a82b033a9e /scripts/kvm
parenta4b2be204b5034f077c45048e5420c9daf1944b1 (diff)
scripts/kvm/kvm_stat: Moved DebugfsProvider
When it is next to the TracepointProvider less scrolling is needed to change related, surrounding code. Reviewed-by: Jason J. Herne <jjherne@linux.vnet.ibm.com> Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com> Message-Id: <1452525484-32309-13-git-send-email-frankja@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'scripts/kvm')
-rwxr-xr-xscripts/kvm/kvm_stat24
1 files changed, 12 insertions, 12 deletions
diff --git a/scripts/kvm/kvm_stat b/scripts/kvm/kvm_stat
index 98e1ec74b0..b5422f86ab 100755
--- a/scripts/kvm/kvm_stat
+++ b/scripts/kvm/kvm_stat
@@ -23,18 +23,6 @@ import struct
import re
from collections import defaultdict
-class DebugfsProvider(object):
- def __init__(self):
- self._fields = walkdir(PATH_DEBUGFS_KVM)[2]
- def fields(self):
- return self._fields
- def select(self, fields):
- self._fields = fields
- def read(self):
- def val(key):
- return int(file(PATH_DEBUGFS_KVM + '/' + key).read())
- return dict([(key, val(key)) for key in self._fields])
-
VMX_EXIT_REASONS = {
'EXCEPTION_NMI': 0,
'EXTERNAL_INTERRUPT': 1,
@@ -441,6 +429,18 @@ class TracepointProvider(object):
ret[name] += val
return ret
+class DebugfsProvider(object):
+ def __init__(self):
+ self._fields = walkdir(PATH_DEBUGFS_KVM)[2]
+ def fields(self):
+ return self._fields
+ def select(self, fields):
+ self._fields = fields
+ def read(self):
+ def val(key):
+ return int(file(PATH_DEBUGFS_KVM + '/' + key).read())
+ return dict([(key, val(key)) for key in self._fields])
+
class Stats:
def __init__(self, providers, fields=None):
self.providers = providers