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 1/9] trace: [tracetool] Add method 'Event.api' to build event names
Date: Wed, 7 May 2014 19:16:38 +0200 [thread overview]
Message-ID: <1399483006-17781-2-git-send-email-stefanha@redhat.com> (raw)
In-Reply-To: <1399483006-17781-1-git-send-email-stefanha@redhat.com>
From: Lluís Vilanova <vilanova@ac.upc.edu>
Makes it easier to ensure proper naming across the different frontends and backends.
Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
scripts/tracetool/__init__.py | 10 +++++++++-
scripts/tracetool/backend/dtrace.py | 6 +++---
scripts/tracetool/backend/simple.py | 10 +++++-----
scripts/tracetool/backend/stderr.py | 5 +++--
scripts/tracetool/backend/ust.py | 7 ++++---
scripts/tracetool/format/h.py | 6 +++---
6 files changed, 27 insertions(+), 17 deletions(-)
diff --git a/scripts/tracetool/__init__.py b/scripts/tracetool/__init__.py
index 175df08..305b99e 100644
--- a/scripts/tracetool/__init__.py
+++ b/scripts/tracetool/__init__.py
@@ -6,7 +6,7 @@ Machinery for generating tracing-related intermediate files.
"""
__author__ = "Lluís Vilanova <vilanova@ac.upc.edu>"
-__copyright__ = "Copyright 2012, Lluís Vilanova <vilanova@ac.upc.edu>"
+__copyright__ = "Copyright 2012-2014, Lluís Vilanova <vilanova@ac.upc.edu>"
__license__ = "GPL version 2 or (at your option) any later version"
__maintainer__ = "Stefan Hajnoczi"
@@ -173,6 +173,14 @@ class Event(object):
self.args,
self.fmt)
+ QEMU_TRACE = "trace_%(name)s"
+
+ def api(self, fmt=None):
+ if fmt is None:
+ fmt = Event.QEMU_TRACE
+ return fmt % {"name": self.name}
+
+
def _read_events(fobj):
res = []
for line in fobj:
diff --git a/scripts/tracetool/backend/dtrace.py b/scripts/tracetool/backend/dtrace.py
index e31bc79..3c369c4 100644
--- a/scripts/tracetool/backend/dtrace.py
+++ b/scripts/tracetool/backend/dtrace.py
@@ -6,7 +6,7 @@ DTrace/SystemTAP backend.
"""
__author__ = "Lluís Vilanova <vilanova@ac.upc.edu>"
-__copyright__ = "Copyright 2012, Lluís Vilanova <vilanova@ac.upc.edu>"
+__copyright__ = "Copyright 2012-2014, Lluís Vilanova <vilanova@ac.upc.edu>"
__license__ = "GPL version 2 or (at your option) any later version"
__maintainer__ = "Stefan Hajnoczi"
@@ -44,10 +44,10 @@ def h(events):
'')
for e in events:
- out('static inline void trace_%(name)s(%(args)s) {',
+ out('static inline void %(api)s(%(args)s) {',
' QEMU_%(uppername)s(%(argnames)s);',
'}',
- name = e.name,
+ api = e.api(),
args = e.args,
uppername = e.name.upper(),
argnames = ", ".join(e.args.names()),
diff --git a/scripts/tracetool/backend/simple.py b/scripts/tracetool/backend/simple.py
index 3dde372..ca48e12 100644
--- a/scripts/tracetool/backend/simple.py
+++ b/scripts/tracetool/backend/simple.py
@@ -6,7 +6,7 @@ Simple built-in backend.
"""
__author__ = "Lluís Vilanova <vilanova@ac.upc.edu>"
-__copyright__ = "Copyright 2012, Lluís Vilanova <vilanova@ac.upc.edu>"
+__copyright__ = "Copyright 2012-2014, Lluís Vilanova <vilanova@ac.upc.edu>"
__license__ = "GPL version 2 or (at your option) any later version"
__maintainer__ = "Stefan Hajnoczi"
@@ -34,10 +34,10 @@ def c(events):
)
for num, event in enumerate(events):
- out('void trace_%(name)s(%(args)s)',
+ out('void %(api)s(%(args)s)',
'{',
' TraceBufferRecord rec;',
- name = event.name,
+ api = event.api(),
args = event.args,
)
sizes = []
@@ -95,7 +95,7 @@ def c(events):
def h(events):
for event in events:
- out('void trace_%(name)s(%(args)s);',
- name = event.name,
+ out('void %(api)s(%(args)s);',
+ api = event.api(),
args = event.args,
)
diff --git a/scripts/tracetool/backend/stderr.py b/scripts/tracetool/backend/stderr.py
index 6f93dbd..6681e26 100644
--- a/scripts/tracetool/backend/stderr.py
+++ b/scripts/tracetool/backend/stderr.py
@@ -6,7 +6,7 @@ Stderr built-in backend.
"""
__author__ = "Lluís Vilanova <vilanova@ac.upc.edu>"
-__copyright__ = "Copyright 2012, Lluís Vilanova <vilanova@ac.upc.edu>"
+__copyright__ = "Copyright 2012-2014, Lluís Vilanova <vilanova@ac.upc.edu>"
__license__ = "GPL version 2 or (at your option) any later version"
__maintainer__ = "Stefan Hajnoczi"
@@ -33,13 +33,14 @@ def h(events):
if len(e.args) > 0:
argnames = ", " + argnames
- out('static inline void trace_%(name)s(%(args)s)',
+ out('static inline void %(api)s(%(args)s)',
'{',
' bool _state = trace_event_get_state(%(event_id)s);',
' if (_state) {',
' fprintf(stderr, "%(name)s " %(fmt)s "\\n" %(argnames)s);',
' }',
'}',
+ api = e.api(),
name = e.name,
args = e.args,
event_id = "TRACE_" + e.name.upper(),
diff --git a/scripts/tracetool/backend/ust.py b/scripts/tracetool/backend/ust.py
index 41c1c75..2fca4d2 100644
--- a/scripts/tracetool/backend/ust.py
+++ b/scripts/tracetool/backend/ust.py
@@ -6,7 +6,7 @@ LTTng User Space Tracing backend.
"""
__author__ = "Lluís Vilanova <vilanova@ac.upc.edu>"
-__copyright__ = "Copyright 2012, Lluís Vilanova <vilanova@ac.upc.edu>"
+__copyright__ = "Copyright 2012-2014, Lluís Vilanova <vilanova@ac.upc.edu>"
__license__ = "GPL version 2 or (at your option) any later version"
__maintainer__ = "Stefan Hajnoczi"
@@ -31,11 +31,12 @@ def h(events):
if len(e.args) > 0:
argnames = ", " + argnames
- out('static inline void trace_%(name)s(%(args)s)',
+ out('static inline void %(api)s(%(args)s)',
'{',
' tracepoint(qemu, %(name)s%(tp_args)s);',
'}',
'',
+ api = e.api()
name = e.name,
args = e.args,
tp_args = argnames,
@@ -79,4 +80,4 @@ def ust_events_h(events):
')',
'',
name = e.name,
- )
\ No newline at end of file
+ )
diff --git a/scripts/tracetool/format/h.py b/scripts/tracetool/format/h.py
index 93132fc..9b0903d 100644
--- a/scripts/tracetool/format/h.py
+++ b/scripts/tracetool/format/h.py
@@ -6,7 +6,7 @@ Generate .h file.
"""
__author__ = "Lluís Vilanova <vilanova@ac.upc.edu>"
-__copyright__ = "Copyright 2012, Lluís Vilanova <vilanova@ac.upc.edu>"
+__copyright__ = "Copyright 2012-2014, Lluís Vilanova <vilanova@ac.upc.edu>"
__license__ = "GPL version 2 or (at your option) any later version"
__maintainer__ = "Stefan Hajnoczi"
@@ -30,9 +30,9 @@ def end(events):
def nop(events):
for e in events:
out('',
- 'static inline void trace_%(name)s(%(args)s)',
+ 'static inline void %(api)s(%(args)s)',
'{',
'}',
- name = e.name,
+ api = e.api(),
args = e.args,
)
--
1.9.0
next prev parent reply other threads:[~2014-05-08 10:17 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-07 17:16 [Qemu-devel] [PULL 0/9] Tracing patches Stefan Hajnoczi
2014-05-07 17:16 ` Stefan Hajnoczi [this message]
2014-05-07 17:16 ` [Qemu-devel] [PULL 2/9] trace: [tracetool] Add methods 'Event.copy' and 'Arguments.copy' Stefan Hajnoczi
2014-05-07 17:16 ` [Qemu-devel] [PULL 3/9] trace: [tracetool] Spacing changes Stefan Hajnoczi
2014-05-07 17:16 ` [Qemu-devel] [PULL 4/9] trace: [tracetool] Cosmetic changes Stefan Hajnoczi
2014-05-07 17:16 ` [Qemu-devel] [PULL 5/9] trace: [tracetool] Show list of frontends and backends sorted by name Stefan Hajnoczi
2014-05-07 17:16 ` [Qemu-devel] [PULL 6/9] trace: [tracetool] Change format docs to point to the generated file Stefan Hajnoczi
2014-05-07 17:16 ` [Qemu-devel] [PULL 7/9] trace: [simple] Bump up log version number Stefan Hajnoczi
2014-05-07 17:16 ` [Qemu-devel] [PULL 8/9] trace: [tracetool] Minimize the amount of per-backend code Stefan Hajnoczi
2014-05-07 17:16 ` [Qemu-devel] [PULL 9/9] configure: Show trace output file conditionally Stefan Hajnoczi
2014-05-09 11:28 ` [Qemu-devel] [PULL 0/9] Tracing patches Peter Maydell
-- strict thread matches above, loose matches on Subject: below --
2014-06-09 13:45 [Qemu-devel] [PULL 0/5] " Stefan Hajnoczi
2014-06-09 13:45 ` [Qemu-devel] [PULL 1/9] trace: [tracetool] Add method 'Event.api' to build event names Stefan Hajnoczi
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=1399483006-17781-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).