diff options
author | Janosch Frank <frankja@linux.vnet.ibm.com> | 2016-01-11 16:17:41 +0100 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2016-01-26 15:58:12 +0100 |
commit | a4b2be204b5034f077c45048e5420c9daf1944b1 (patch) | |
tree | beb01eceb49a24bd77c89859b6294a8f7715874d /scripts | |
parent | e02d896e45d5dbb2855a591f8f1e05876df3334b (diff) |
scripts/kvm/kvm_stat: Rename variables that redefine globals
Filter, id and byte are builtin python modules which should not be
redefined by local variables.
Reviewed-by: Jason J. Herne <jjherne@linux.vnet.ibm.com>
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com>
Message-Id: <1452525484-32309-12-git-send-email-frankja@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/kvm/kvm_stat | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/scripts/kvm/kvm_stat b/scripts/kvm/kvm_stat index b1e5853b4d..98e1ec74b0 100755 --- a/scripts/kvm/kvm_stat +++ b/scripts/kvm/kvm_stat @@ -333,20 +333,21 @@ class Group(object): self.events = [] self.group_leader = None self.cpu = cpu - def add_event(self, name, event_set, tracepoint, filter=None): + def add_event(self, name, event_set, tracepoint, tracefilter=None): self.events.append(Event(group=self, name=name, event_set=event_set, - tracepoint=tracepoint, filter=filter)) + tracepoint=tracepoint, + tracefilter=tracefilter)) if len(self.events) == 1: self.file = os.fdopen(self.events[0].fd) def read(self): - bytes = 8 * (1 + len(self.events)) + length = 8 * (1 + len(self.events)) fmt = 'xxxxxxxx' + 'q' * len(self.events) return dict(zip([event.name for event in self.events], - struct.unpack(fmt, self.file.read(bytes)))) + struct.unpack(fmt, self.file.read(length)))) class Event(object): - def __init__(self, group, name, event_set, tracepoint, filter=None): + def __init__(self, group, name, event_set, tracepoint, tracefilter=None): self.name = name attr = perf_event_attr() attr.type = PERF_TYPE_TRACEPOINT @@ -364,8 +365,8 @@ class Event(object): if fd == -1: err = get_errno()[0] raise Exception('perf_event_open failed, errno = ' + err.__str__()) - if filter: - fcntl.ioctl(fd, IOCTL_NUMBERS['SET_FILTER'], filter) + if tracefilter: + fcntl.ioctl(fd, IOCTL_NUMBERS['SET_FILTER'], tracefilter) self.fd = fd def enable(self): fcntl.ioctl(self.fd, IOCTL_NUMBERS['ENABLE'], 0) @@ -415,15 +416,15 @@ class TracepointProvider(object): group = Group(cpu) for name in _fields: tracepoint = name - filter = None + tracefilter = None m = re.match(r'(.*)\((.*)\)', name) if m: tracepoint, sub = m.groups() - filter = '%s==%d\0' % (filters[tracepoint][0], - filters[tracepoint][1][sub]) + tracefilter = '%s==%d\0' % (filters[tracepoint][0], + filters[tracepoint][1][sub]) event = group.add_event(name, event_set='kvm', tracepoint=tracepoint, - filter=filter) + tracefilter=tracefilter) self.group_leaders.append(group) def select(self, fields): for group in self.group_leaders: |