From: Stefan Hajnoczi <stefanha@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
"Lluís Vilanova" <vilanova@ac.upc.edu>,
"Stefan Hajnoczi" <stefanha@redhat.com>
Subject: [Qemu-devel] [PULL 01/16] trace: [ust] Fix format string computation in tcg-enabled events
Date: Fri, 26 Sep 2014 11:59:22 +0100 [thread overview]
Message-ID: <1411729177-5222-2-git-send-email-stefanha@redhat.com> (raw)
In-Reply-To: <1411729177-5222-1-git-send-email-stefanha@redhat.com>
From: Lluís Vilanova <vilanova@ac.upc.edu>
TCG-enabled events start with two format strings. Delay per-argument format
computation until requested ('Event.formats').
Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
scripts/tracetool/__init__.py | 19 ++++++++++---------
scripts/tracetool/format/ust_events_h.py | 2 +-
2 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/scripts/tracetool/__init__.py b/scripts/tracetool/__init__.py
index 36c789d..854fb9e 100644
--- a/scripts/tracetool/__init__.py
+++ b/scripts/tracetool/__init__.py
@@ -136,8 +136,7 @@ class Event(object):
Properties of the event.
args : Arguments
The event arguments.
- arg_fmts : str
- The format strings for each argument.
+
"""
_CRE = re.compile("((?P<props>.*)\s+)?"
@@ -146,11 +145,10 @@ class Event(object):
"\s*"
"(?:(?:(?P<fmt_trans>\".+),)?\s*(?P<fmt>\".+))?"
"\s*")
- _FMT = re.compile("(%\w+|%.*PRI\S+)")
_VALID_PROPS = set(["disable", "tcg", "tcg-trans", "tcg-exec"])
- def __init__(self, name, props, fmt, args, arg_fmts, orig=None):
+ def __init__(self, name, props, fmt, args, orig=None):
"""
Parameters
----------
@@ -162,8 +160,6 @@ class Event(object):
Event printing format (or formats).
args : Arguments
Event arguments.
- arg_fmts : list of str
- Format strings for each argument.
orig : Event or None
Original Event before transformation.
@@ -172,7 +168,6 @@ class Event(object):
self.properties = props
self.fmt = fmt
self.args = args
- self.arg_fmts = arg_fmts
if orig is None:
self.original = weakref.ref(self)
@@ -210,7 +205,6 @@ class Event(object):
if len(fmt_trans) > 0:
fmt = [fmt_trans, fmt]
args = Arguments.build(groups["args"])
- arg_fmts = Event._FMT.findall(fmt)
if "tcg-trans" in props:
raise ValueError("Invalid property 'tcg-trans'")
@@ -221,7 +215,7 @@ class Event(object):
if "tcg" in props and isinstance(fmt, str):
raise ValueError("Events with 'tcg' property must have two formats")
- return Event(name, props, fmt, args, arg_fmts)
+ return Event(name, props, fmt, args)
def __repr__(self):
"""Evaluable string representation for this object."""
@@ -234,6 +228,13 @@ class Event(object):
self.args,
fmt)
+ _FMT = re.compile("(%\w+|%.*PRI\S+)")
+
+ def formats(self):
+ """List of argument print formats."""
+ assert not isinstance(self.fmt, list)
+ return self._FMT.findall(self.fmt)
+
QEMU_TRACE = "trace_%(name)s"
QEMU_TRACE_TCG = QEMU_TRACE + "_tcg"
diff --git a/scripts/tracetool/format/ust_events_h.py b/scripts/tracetool/format/ust_events_h.py
index d189899..3e8a7cd 100644
--- a/scripts/tracetool/format/ust_events_h.py
+++ b/scripts/tracetool/format/ust_events_h.py
@@ -65,7 +65,7 @@ def generate(events, backend):
types = e.args.types()
names = e.args.names()
- fmts = e.arg_fmts
+ fmts = e.formats()
for t,n,f in zip(types, names, fmts):
if ('char *' in t) or ('char*' in t):
out(' ctf_string(' + n + ', ' + n + ')')
--
1.9.3
next prev parent reply other threads:[~2014-09-26 11:00 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-26 10:59 [Qemu-devel] [PULL 00/16] Tracing patches Stefan Hajnoczi
2014-09-26 10:59 ` Stefan Hajnoczi [this message]
2014-09-26 10:59 ` [Qemu-devel] [PULL 02/16] trace: docs: add trace file description Stefan Hajnoczi
2014-09-26 10:59 ` [Qemu-devel] [PULL 03/16] trace: [qmp] Add commands to query and control event tracing state Stefan Hajnoczi
2014-09-26 10:59 ` [Qemu-devel] [PULL 04/16] trace: [hmp] Reimplement "trace-event" and "info trace-events" using QMP Stefan Hajnoczi
2014-09-26 10:59 ` [Qemu-devel] [PULL 05/16] trace-events: drop orphan virtio_blk_data_plane_complete_request Stefan Hajnoczi
2014-09-26 10:59 ` [Qemu-devel] [PULL 06/16] trace-events: drop orphan usb_mtp_data_out Stefan Hajnoczi
2014-09-26 10:59 ` [Qemu-devel] [PULL 07/16] trace-events: drop orphan iscsi trace events Stefan Hajnoczi
2014-09-26 10:59 ` [Qemu-devel] [PULL 08/16] trace: tighten up trace-events regex to fix bad parse Stefan Hajnoczi
2014-09-26 10:59 ` [Qemu-devel] [PULL 09/16] cleanup-trace-events.pl: Tighten search for trace event call Stefan Hajnoczi
2014-09-26 10:59 ` [Qemu-devel] [PULL 10/16] trace-events: Drop unused megasas trace event Stefan Hajnoczi
2014-09-26 10:59 ` [Qemu-devel] [PULL 11/16] trace-events: Drop orphaned monitor " Stefan Hajnoczi
2014-09-26 10:59 ` [Qemu-devel] [PULL 12/16] trace-events: Fix comments pointing to source files Stefan Hajnoczi
2014-09-26 10:59 ` [Qemu-devel] [PULL 13/16] trace: install trace-events file Stefan Hajnoczi
2014-09-26 10:59 ` [Qemu-devel] [PULL 14/16] scripts/tracetool: don't barf on formats with precision Stefan Hajnoczi
2014-09-26 10:59 ` [Qemu-devel] [PULL 15/16] ohci: Split long traces to smaller ones Stefan Hajnoczi
2014-09-26 10:59 ` [Qemu-devel] [PULL 16/16] ohci: drop computed flags from trace events Stefan Hajnoczi
2014-09-26 13:16 ` [Qemu-devel] [PULL 00/16] Tracing patches Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1411729177-5222-2-git-send-email-stefanha@redhat.com \
--to=stefanha@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=vilanova@ac.upc.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).