提交 d1b97bce 编写于 作者: D Daniel P. Berrange 提交者: Stefan Hajnoczi

trace: rename _read_events to read_events

The _read_events method is used by callers outside of
its module, so should be a public method, not private.
Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: NLluís Vilanova <vilanova@ac.upc.edu>
Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
Message-id: 1475588159-30598-18-git-send-email-berrange@redhat.com
Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
上级 34770187
......@@ -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__':
......
......@@ -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)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册