[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 29/49] scripts/kvm/kvm_stat: Cleanup of Groups class
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 29/49] scripts/kvm/kvm_stat: Cleanup of Groups class |
Date: |
Tue, 26 Jan 2016 14:47:01 +0100 |
From: Janosch Frank <address@hidden>
Introduced separating newlines for readability and removed special
treatment/variable of the group leader. Renamed fmt to read_format.
The group leader's file descriptor will not be turned into a file
object anymore, instead os.read is used to read from the descriptor.
Signed-off-by: Janosch Frank <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
scripts/kvm/kvm_stat | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/scripts/kvm/kvm_stat b/scripts/kvm/kvm_stat
index 203873e..91054e5 100755
--- a/scripts/kvm/kvm_stat
+++ b/scripts/kvm/kvm_stat
@@ -341,20 +341,20 @@ PATH_DEBUGFS_KVM = '/sys/kernel/debug/kvm'
class Group(object):
def __init__(self, cpu):
self.events = []
- self.group_leader = None
self.cpu = cpu
+
def add_event(self, name, event_set, tracepoint, tracefilter=None):
self.events.append(Event(group=self,
name=name, event_set=event_set,
tracepoint=tracepoint,
tracefilter=tracefilter))
- if len(self.events) == 1:
- self.file = os.fdopen(self.events[0].fd)
+
def read(self):
length = 8 * (1 + len(self.events))
- fmt = 'xxxxxxxx' + 'q' * len(self.events)
+ read_format = 'xxxxxxxx' + 'q' * len(self.events)
return dict(zip([event.name for event in self.events],
- struct.unpack(fmt, self.file.read(length))))
+ struct.unpack(read_format,
+ os.read(self.events[0].fd, length))))
class Event(object):
def __init__(self, group, name, event_set, tracepoint, tracefilter=None):
--
1.8.3.1
- [Qemu-devel] [PULL 20/49] scripts/kvm/kvm_stat: Set sensible no. files rlimit, (continued)
- [Qemu-devel] [PULL 20/49] scripts/kvm/kvm_stat: Set sensible no. files rlimit, Paolo Bonzini, 2016/01/26
- [Qemu-devel] [PULL 19/49] scripts/kvm/kvm_stat: Fixup syscall error reporting, Paolo Bonzini, 2016/01/26
- [Qemu-devel] [PULL 23/49] scripts/kvm/kvm_stat: Rename _perf_event_open, Paolo Bonzini, 2016/01/26
- [Qemu-devel] [PULL 22/49] scripts/kvm/kvm_stat: Make cpu detection a function, Paolo Bonzini, 2016/01/26
- [Qemu-devel] [PULL 21/49] scripts/kvm/kvm_stat: Cleanup of platform detection, Paolo Bonzini, 2016/01/26
- [Qemu-devel] [PULL 26/49] scripts/kvm/kvm_stat: Cleanup cpu list retrieval, Paolo Bonzini, 2016/01/26
- [Qemu-devel] [PULL 27/49] scripts/kvm/kvm_stat: Encapsulate filters variable, Paolo Bonzini, 2016/01/26
- [Qemu-devel] [PULL 25/49] scripts/kvm/kvm_stat: Cleanup of TracepointProvider, Paolo Bonzini, 2016/01/26
- [Qemu-devel] [PULL 24/49] scripts/kvm/kvm_stat: Introduce properties for providers, Paolo Bonzini, 2016/01/26
- [Qemu-devel] [PULL 30/49] scripts/kvm/kvm_stat: Cleanup of Event class, Paolo Bonzini, 2016/01/26
- [Qemu-devel] [PULL 29/49] scripts/kvm/kvm_stat: Cleanup of Groups class,
Paolo Bonzini <=
- [Qemu-devel] [PULL 28/49] scripts/kvm/kvm_stat: Cleanup of Stats class, Paolo Bonzini, 2016/01/26
- [Qemu-devel] [PULL 36/49] scripts/kvm/kvm_stat: Read event values as u64, Paolo Bonzini, 2016/01/26
- [Qemu-devel] [PULL 31/49] scripts/kvm/kvm_stat: Group arch specific data, Paolo Bonzini, 2016/01/26
- [Qemu-devel] [PULL 34/49] scripts/kvm/kvm_stat: Fix output formatting, Paolo Bonzini, 2016/01/26
- [Qemu-devel] [PULL 33/49] scripts/kvm/kvm_stat: Make tui function a class, Paolo Bonzini, 2016/01/26
- [Qemu-devel] [PULL 37/49] scripts/kvm/kvm_stat: Fix rlimit for unprivileged users, Paolo Bonzini, 2016/01/26
- [Qemu-devel] [PULL 38/49] scripts/kvm/kvm_stat: Fixup filtering, Paolo Bonzini, 2016/01/26
- [Qemu-devel] [PULL 32/49] scripts/kvm/kvm_stat: Remove unneeded X86_EXIT_REASONS, Paolo Bonzini, 2016/01/26
- [Qemu-devel] [PULL 35/49] scripts/kvm/kvm_stat: Cleanup and pre-init perf_event_attr, Paolo Bonzini, 2016/01/26
- [Qemu-devel] [PULL 40/49] scripts/kvm/kvm_stat: Add optparse description, Paolo Bonzini, 2016/01/26