提交 4ade0541 编写于 作者: L Lluís Vilanova 提交者: Stefan Hajnoczi

trace: Add a proper API to manage auto-generated events from the 'tcg' property

Formalizes the existence of the 'event_trans' and 'event_exec' event
attributes, which until now were monkey-patched only when necessary.
Signed-off-by: NLluís Vilanova <vilanova@ac.upc.edu>
Message-id: 145640558759.20978.6374959404425591089.stgit@localhost
Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
上级 3d211d9f
...@@ -163,7 +163,8 @@ class Event(object): ...@@ -163,7 +163,8 @@ class Event(object):
_VALID_PROPS = set(["disable", "tcg", "tcg-trans", "tcg-exec", "vcpu"]) _VALID_PROPS = set(["disable", "tcg", "tcg-trans", "tcg-exec", "vcpu"])
def __init__(self, name, props, fmt, args, orig=None): def __init__(self, name, props, fmt, args, orig=None,
event_trans=None, event_exec=None):
""" """
Parameters Parameters
---------- ----------
...@@ -176,13 +177,19 @@ class Event(object): ...@@ -176,13 +177,19 @@ class Event(object):
args : Arguments args : Arguments
Event arguments. Event arguments.
orig : Event or None orig : Event or None
Original Event before transformation. Original Event before transformation/generation.
event_trans : Event or None
Generated translation-time event ("tcg" property).
event_exec : Event or None
Generated execution-time event ("tcg" property).
""" """
self.name = name self.name = name
self.properties = props self.properties = props
self.fmt = fmt self.fmt = fmt
self.args = args self.args = args
self.event_trans = event_trans
self.event_exec = event_exec
if orig is None: if orig is None:
self.original = weakref.ref(self) self.original = weakref.ref(self)
...@@ -198,7 +205,7 @@ class Event(object): ...@@ -198,7 +205,7 @@ class Event(object):
def copy(self): def copy(self):
"""Create a new copy.""" """Create a new copy."""
return Event(self.name, list(self.properties), self.fmt, return Event(self.name, list(self.properties), self.fmt,
self.args.copy(), self) self.args.copy(), self, self.event_trans, self.event_exec)
@staticmethod @staticmethod
def build(line_str): def build(line_str):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册