diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2014-09-26 12:26:07 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2014-09-26 12:26:07 +0100 |
commit | da1c4ec88ad50c2b73d5fe960c373693f7337cc9 (patch) | |
tree | 575695c08ab0c41cb4d17322139377b13fb283bb /scripts | |
parent | 15124e142034d21341ec9f1a304a1dc5a6c25681 (diff) | |
parent | bc0d104c6a3dc685e3adf92d89a017b2adc9878a (diff) | |
download | qemu-da1c4ec88ad50c2b73d5fe960c373693f7337cc9.zip qemu-da1c4ec88ad50c2b73d5fe960c373693f7337cc9.tar.gz qemu-da1c4ec88ad50c2b73d5fe960c373693f7337cc9.tar.bz2 |
Merge remote-tracking branch 'remotes/stefanha/tags/tracing-pull-request' into staging
# gpg: Signature made Fri 26 Sep 2014 11:59:34 BST using RSA key ID 81AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>"
# gpg: aka "Stefan Hajnoczi <stefanha@gmail.com>"
* remotes/stefanha/tags/tracing-pull-request:
ohci: drop computed flags from trace events
ohci: Split long traces to smaller ones
scripts/tracetool: don't barf on formats with precision
trace: install trace-events file
trace-events: Fix comments pointing to source files
trace-events: Drop orphaned monitor trace event
trace-events: Drop unused megasas trace event
cleanup-trace-events.pl: Tighten search for trace event call
trace: tighten up trace-events regex to fix bad parse
trace-events: drop orphan iscsi trace events
trace-events: drop orphan usb_mtp_data_out
trace-events: drop orphan virtio_blk_data_plane_complete_request
trace: [hmp] Reimplement "trace-event" and "info trace-events" using QMP
trace: [qmp] Add commands to query and control event tracing state
trace: docs: add trace file description
trace: [ust] Fix format string computation in tcg-enabled events
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/cleanup-trace-events.pl | 2 | ||||
-rw-r--r-- | scripts/tracetool/__init__.py | 23 | ||||
-rw-r--r-- | scripts/tracetool/format/ust_events_h.py | 2 |
3 files changed, 14 insertions, 13 deletions
diff --git a/scripts/cleanup-trace-events.pl b/scripts/cleanup-trace-events.pl index cffbf16..7e808ef 100755 --- a/scripts/cleanup-trace-events.pl +++ b/scripts/cleanup-trace-events.pl @@ -25,7 +25,7 @@ sub out { while (<>) { if (/^(disable )?([a-z_0-9]+)\(/) { - open GREP, '-|', 'git', 'grep', '-l', "trace_$2" + open GREP, '-|', 'git', 'grep', '-lw', "trace_$2" or die "run git grep: $!"; my $fname; while ($fname = <GREP>) { diff --git a/scripts/tracetool/__init__.py b/scripts/tracetool/__init__.py index 36c789d..3d5743f 100644 --- a/scripts/tracetool/__init__.py +++ b/scripts/tracetool/__init__.py @@ -136,21 +136,19 @@ 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+)?" - "(?P<name>[^(\s]+)" + _CRE = re.compile("((?P<props>[\w\s]+)\s+)?" + "(?P<name>\w+)" "\((?P<args>[^)]*)\)" "\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("(%[\d\.]*\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 + ')') |