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>
This commit is contained in:
Janosch Frank 2016-01-11 16:17:42 +01:00 committed by Paolo Bonzini
parent a4b2be204b
commit f4109dba21

View File

@ -23,18 +23,6 @@ import struct
import re import re
from collections import defaultdict 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 = { VMX_EXIT_REASONS = {
'EXCEPTION_NMI': 0, 'EXCEPTION_NMI': 0,
'EXTERNAL_INTERRUPT': 1, 'EXTERNAL_INTERRUPT': 1,
@ -441,6 +429,18 @@ class TracepointProvider(object):
ret[name] += val ret[name] += val
return ret 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: class Stats:
def __init__(self, providers, fields=None): def __init__(self, providers, fields=None):
self.providers = providers self.providers = providers