[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v5 17/20] trace: rename _read_events to read_events
From: |
Daniel P. Berrange |
Subject: |
[Qemu-devel] [PATCH v5 17/20] trace: rename _read_events to read_events |
Date: |
Wed, 28 Sep 2016 14:08:20 +0100 |
The _read_events method is used by callers outside of
its module, so should be a public method, not private.
Reviewed-by: Lluís Vilanova <address@hidden>
Signed-off-by: Daniel P. Berrange <address@hidden>
---
scripts/simpletrace.py | 6 +++---
scripts/tracetool/__init__.py | 14 ++++++++++++--
2 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/scripts/simpletrace.py b/scripts/simpletrace.py
index 0245c23..d66bf15 100755
--- a/scripts/simpletrace.py
+++ b/scripts/simpletrace.py
@@ -12,7 +12,7 @@
import struct
import re
import inspect
-from tracetool import _read_events, Event
+from tracetool import read_events, Event
from tracetool.backend.simple import is_string
header_event_id = 0xffffffffffffffff
@@ -129,7 +129,7 @@ class Analyzer(object):
def process(events, log, analyzer, read_header=True):
"""Invoke an analyzer on each event in a log."""
if isinstance(events, str):
- events = _read_events(open(events, 'r'))
+ events = read_events(open(events, 'r'))
if isinstance(log, str):
log = open(log, 'rb')
@@ -188,7 +188,7 @@ def run(analyzer):
'<trace-file>\n' % sys.argv[0])
sys.exit(1)
- events = _read_events(open(sys.argv[1], 'r'))
+ events = read_events(open(sys.argv[1], 'r'))
process(events, sys.argv[2], analyzer, read_header=read_header)
if __name__ == '__main__':
diff --git a/scripts/tracetool/__init__.py b/scripts/tracetool/__init__.py
index dc93416..bf01e93 100644
--- a/scripts/tracetool/__init__.py
+++ b/scripts/tracetool/__init__.py
@@ -282,7 +282,17 @@ class Event(object):
self)
-def _read_events(fobj):
+def read_events(fobj):
+ """Generate the output for the given (format, backends) pair.
+
+ Parameters
+ ----------
+ fobj : file
+ Event description file.
+
+ Returns a list of Event objects
+ """
+
events = []
for line in fobj:
if not line.strip():
@@ -391,6 +401,6 @@ def generate(fevents, format, backends,
tracetool.backend.dtrace.BINARY = binary
tracetool.backend.dtrace.PROBEPREFIX = probe_prefix
- events = _read_events(fevents)
+ events = read_events(fevents)
tracetool.format.generate(events, format, backend)
--
2.7.4
- [Qemu-devel] [PATCH v5 09/20] trace: give each trace event a named TraceEvent struct, (continued)
- [Qemu-devel] [PATCH v5 09/20] trace: give each trace event a named TraceEvent struct, Daniel P. Berrange, 2016/09/28
- [Qemu-devel] [PATCH v5 11/20] trace: emit name <-> ID mapping in simpletrace header, Daniel P. Berrange, 2016/09/28
- [Qemu-devel] [PATCH v5 14/20] trace: dynamically allocate trace_dstate in CPUState, Daniel P. Berrange, 2016/09/28
- [Qemu-devel] [PATCH v5 10/20] trace: remove the TraceEventID and TraceEventVCPUID enums, Daniel P. Berrange, 2016/09/28
- [Qemu-devel] [PATCH v5 13/20] trace: provide mechanism for registering trace events, Daniel P. Berrange, 2016/09/28
- [Qemu-devel] [PATCH v5 15/20] trace: dynamically allocate event IDs at runtime, Daniel P. Berrange, 2016/09/28
- [Qemu-devel] [PATCH v5 16/20] trace: get rid of generated-events.h/generated-events.c, Daniel P. Berrange, 2016/09/28
- [Qemu-devel] [PATCH v5 18/20] trace: push reading of events up a level to tracetool main, Daniel P. Berrange, 2016/09/28
- [Qemu-devel] [PATCH v5 17/20] trace: rename _read_events to read_events,
Daniel P. Berrange <=
- [Qemu-devel] [PATCH v5 19/20] trace: pass trace-events to tracetool as a positional param, Daniel P. Berrange, 2016/09/28
- [Qemu-devel] [PATCH v5 20/20] trace: introduce a formal group name for trace events, Daniel P. Berrange, 2016/09/28