All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/4] Tracetool cleanup
@ 2014-02-17 19:36 Lluís Vilanova
  2014-02-17 19:36 ` [Qemu-devel] [PATCH 1/4] trace: [tracetool] Add method 'Event.api' to build event names Lluís Vilanova
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Lluís Vilanova @ 2014-02-17 19:36 UTC (permalink / raw)
  To: qemu-devel; +Cc: Kazuya Saito, Stefan Hajnoczi

Minimizes the amount of backend code, making it simpler to add new/different
backends.

Also performs other cleanups all around.

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
---

Lluís Vilanova (4):
      trace: [tracetool] Add method 'Event.api' to build event names
      trace: [tracetool,trivial] Style changes
      trace: [tracetool] Identify formats directly used by QEMU
      trace: [tracetool] Minimize the amount of per-backend code


 scripts/simpletrace.py                |    6 --
 scripts/tracetool/__init__.py         |   53 +++++++------
 scripts/tracetool/backend/__init__.py |   74 ++++++++-----------
 scripts/tracetool/backend/dtrace.py   |   81 ++------------------
 scripts/tracetool/backend/events.py   |   23 ------
 scripts/tracetool/backend/ftrace.py   |   56 ++++++--------
 scripts/tracetool/backend/simple.py   |  132 ++++++++++++++++-----------------
 scripts/tracetool/backend/stderr.py   |   43 ++++-------
 scripts/tracetool/backend/ust.py      |   44 +++++------
 scripts/tracetool/format/__init__.py  |   61 +++++++--------
 scripts/tracetool/format/c.py         |   16 +++-
 scripts/tracetool/format/d.py         |   30 +++++++-
 scripts/tracetool/format/events_c.py  |   18 ++---
 scripts/tracetool/format/events_h.py  |   18 ++---
 scripts/tracetool/format/h.py         |   33 +++++---
 scripts/tracetool/format/stap.py      |   42 ++++++++++-
 trace/Makefile.objs                   |    4 +
 17 files changed, 343 insertions(+), 391 deletions(-)
 delete mode 100644 scripts/tracetool/backend/events.py


To: qemu-devel@nongnu.org
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Cc: Kazuya Saito <saito.kazuya@jp.fujitsu.com>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Qemu-devel] [PATCH 1/4] trace: [tracetool] Add method 'Event.api' to build event names
  2014-02-17 19:36 [Qemu-devel] [PATCH 0/4] Tracetool cleanup Lluís Vilanova
@ 2014-02-17 19:36 ` Lluís Vilanova
  2014-02-17 19:36 ` [Qemu-devel] [PATCH 2/4] trace: [tracetool,trivial] Style changes Lluís Vilanova
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Lluís Vilanova @ 2014-02-17 19:36 UTC (permalink / raw)
  To: qemu-devel; +Cc: Kazuya Saito, Stefan Hajnoczi

Makes it easier to ensure proper naming across the different frontends and backends.

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
---
 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    |    8 +++++---
 scripts/tracetool/format/h.py       |    6 +++---
 6 files changed, 28 insertions(+), 17 deletions(-)

diff --git a/scripts/tracetool/__init__.py b/scripts/tracetool/__init__.py
index 175df08..7f9161d 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 ea36995..180b1bf 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"
@@ -78,7 +78,8 @@ def h(events):
     for e in events:
         if len(e.args) > 0:
             out('DECLARE_TRACE(ust_%(name)s, TP_PROTO(%(args)s), TP_ARGS(%(argnames)s));',
-                '#define trace_%(name)s trace_ust_%(name)s',
+                '#define %(api)s trace_ust_%(name)s',
+                api = e.api(),
                 name = e.name,
                 args = e.args,
                 argnames = ", ".join(e.args.names()),
@@ -86,7 +87,8 @@ def h(events):
 
         else:
             out('_DECLARE_TRACEPOINT_NOARGS(ust_%(name)s);',
-                '#define trace_%(name)s trace_ust_%(name)s',
+                '#define %(api)s trace_ust_%(name)s',
+                api = e.api(),
                 name = e.name,
                 )
 
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,
             )

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Qemu-devel] [PATCH 2/4] trace: [tracetool,trivial] Style changes
  2014-02-17 19:36 [Qemu-devel] [PATCH 0/4] Tracetool cleanup Lluís Vilanova
  2014-02-17 19:36 ` [Qemu-devel] [PATCH 1/4] trace: [tracetool] Add method 'Event.api' to build event names Lluís Vilanova
@ 2014-02-17 19:36 ` Lluís Vilanova
  2014-02-17 19:36 ` [Qemu-devel] [PATCH 3/4] trace: [tracetool] Identify formats directly used by QEMU Lluís Vilanova
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Lluís Vilanova @ 2014-02-17 19:36 UTC (permalink / raw)
  To: qemu-devel; +Cc: Kazuya Saito, Stefan Hajnoczi

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
---
 scripts/tracetool/__init__.py         |   25 +++++++++++++++----------
 scripts/tracetool/backend/__init__.py |    2 +-
 scripts/tracetool/format/__init__.py  |    2 +-
 scripts/tracetool/format/c.py         |    4 ++--
 scripts/tracetool/format/d.py         |    4 ++--
 scripts/tracetool/format/events_c.py  |    4 ++--
 scripts/tracetool/format/events_h.py  |    4 ++--
 scripts/tracetool/format/h.py         |    2 +-
 8 files changed, 26 insertions(+), 21 deletions(-)

diff --git a/scripts/tracetool/__init__.py b/scripts/tracetool/__init__.py
index 7f9161d..cca5072 100644
--- a/scripts/tracetool/__init__.py
+++ b/scripts/tracetool/__init__.py
@@ -144,7 +144,12 @@ class Event(object):
 
         unknown_props = set(self.properties) - self._VALID_PROPS
         if len(unknown_props) > 0:
-            raise ValueError("Unknown properties: %s" % ", ".join(unknown_props))
+            raise ValueError("Unknown properties: %s" %
+                             ", ".join(unknown_props))
+
+    def copy(other):
+        return Event(other.name, list(other.properties), other.fmt, other.args,
+                     other)
 
     @staticmethod
     def build(line_str):
@@ -197,7 +202,7 @@ class TracetoolError (Exception):
     pass
 
 
-def try_import(mod_name, attr_name = None, attr_default = None):
+def try_import(mod_name, attr_name=None, attr_default=None):
     """Try to import a module and get an attribute from it.
 
     Parameters
@@ -224,7 +229,7 @@ def try_import(mod_name, attr_name = None, attr_default = None):
 
 
 def generate(fevents, format, backend,
-             binary = None, probe_prefix = None):
+             binary=None, probe_prefix=None):
     """Generate the output for the given (format, backend) pair.
 
     Parameters
@@ -246,18 +251,18 @@ def generate(fevents, format, backend,
     format = str(format)
     if len(format) is 0:
         raise TracetoolError("format not set")
-    mformat = format.replace("-", "_")
-    if not tracetool.format.exists(mformat):
+    if not tracetool.format.exists(format):
         raise TracetoolError("unknown format: %s" % format)
+    format = format.replace("-", "_")
 
     backend = str(backend)
     if len(backend) is 0:
         raise TracetoolError("backend not set")
-    mbackend = backend.replace("-", "_")
-    if not tracetool.backend.exists(mbackend):
+    if not tracetool.backend.exists(backend):
         raise TracetoolError("unknown backend: %s" % backend)
+    backend = backend.replace("-", "_")
 
-    if not tracetool.backend.compatible(mbackend, mformat):
+    if not tracetool.backend.compatible(backend, format):
         raise TracetoolError("backend '%s' not compatible with format '%s'" %
                              (backend, format))
 
@@ -270,7 +275,7 @@ def generate(fevents, format, backend,
     if backend == "nop":
         ( e.properies.add("disable") for e in events )
 
-    tracetool.format.generate_begin(mformat, events)
+    tracetool.format.generate_begin(format, events)
     tracetool.backend.generate("nop", format,
                                [ e
                                  for e in events
@@ -279,4 +284,4 @@ def generate(fevents, format, backend,
                                [ e
                                  for e in events
                                  if "disable" not in e.properties ])
-    tracetool.format.generate_end(mformat, events)
+    tracetool.format.generate_end(format, events)
diff --git a/scripts/tracetool/backend/__init__.py b/scripts/tracetool/backend/__init__.py
index f0314ee..88f94fd 100644
--- a/scripts/tracetool/backend/__init__.py
+++ b/scripts/tracetool/backend/__init__.py
@@ -59,7 +59,7 @@ def get_list(only_public = False):
     for filename in os.listdir(tracetool.backend.__path__[0]):
         if filename.endswith('.py') and filename != '__init__.py':
             modnames.append(filename.rsplit('.', 1)[0])
-    for modname in modnames:
+    for modname in sorted(modnames):
         module = tracetool.try_import("tracetool.backend." + modname)
 
         # just in case; should never fail unless non-module files are put there
diff --git a/scripts/tracetool/format/__init__.py b/scripts/tracetool/format/__init__.py
index 3c2a0d8..577a224 100644
--- a/scripts/tracetool/format/__init__.py
+++ b/scripts/tracetool/format/__init__.py
@@ -53,7 +53,7 @@ def get_list():
     for filename in os.listdir(tracetool.format.__path__[0]):
         if filename.endswith('.py') and filename != '__init__.py':
             modnames.append(filename.rsplit('.', 1)[0])
-    for modname in modnames:
+    for modname in sorted(modnames):
         module = tracetool.try_import("tracetool.format." + modname)
 
         # just in case; should never fail unless non-module files are put there
diff --git a/scripts/tracetool/format/c.py b/scripts/tracetool/format/c.py
index 35555ae..930140b 100644
--- a/scripts/tracetool/format/c.py
+++ b/scripts/tracetool/format/c.py
@@ -2,11 +2,11 @@
 # -*- coding: utf-8 -*-
 
 """
-Generate .c file.
+trace/generated-tracers.c
 """
 
 __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"
diff --git a/scripts/tracetool/format/d.py b/scripts/tracetool/format/d.py
index a2d5947..74ee0d3 100644
--- a/scripts/tracetool/format/d.py
+++ b/scripts/tracetool/format/d.py
@@ -2,11 +2,11 @@
 # -*- coding: utf-8 -*-
 
 """
-Generate .d file (DTrace only).
+trace/generated-tracers.dtrace (DTrace only).
 """
 
 __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"
diff --git a/scripts/tracetool/format/events_c.py b/scripts/tracetool/format/events_c.py
index d670ec8..ea668ee 100644
--- a/scripts/tracetool/format/events_c.py
+++ b/scripts/tracetool/format/events_c.py
@@ -2,11 +2,11 @@
 # -*- coding: utf-8 -*-
 
 """
-Generate .c for event description.
+trace/generated-events.c
 """
 
 __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"
diff --git a/scripts/tracetool/format/events_h.py b/scripts/tracetool/format/events_h.py
index d30ccea..f3febae 100644
--- a/scripts/tracetool/format/events_h.py
+++ b/scripts/tracetool/format/events_h.py
@@ -2,11 +2,11 @@
 # -*- coding: utf-8 -*-
 
 """
-Generate .h for event description.
+trace/generated-events.h
 """
 
 __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"
diff --git a/scripts/tracetool/format/h.py b/scripts/tracetool/format/h.py
index 9b0903d..85f011f 100644
--- a/scripts/tracetool/format/h.py
+++ b/scripts/tracetool/format/h.py
@@ -2,7 +2,7 @@
 # -*- coding: utf-8 -*-
 
 """
-Generate .h file.
+trace/generated-tracers.h
 """
 
 __author__     = "Lluís Vilanova <vilanova@ac.upc.edu>"

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Qemu-devel] [PATCH 3/4] trace: [tracetool] Identify formats directly used by QEMU
  2014-02-17 19:36 [Qemu-devel] [PATCH 0/4] Tracetool cleanup Lluís Vilanova
  2014-02-17 19:36 ` [Qemu-devel] [PATCH 1/4] trace: [tracetool] Add method 'Event.api' to build event names Lluís Vilanova
  2014-02-17 19:36 ` [Qemu-devel] [PATCH 2/4] trace: [tracetool,trivial] Style changes Lluís Vilanova
@ 2014-02-17 19:36 ` Lluís Vilanova
  2014-02-17 19:36 ` [Qemu-devel] [PATCH 4/4] trace: [tracetool] Minimize the amount of per-backend code Lluís Vilanova
  2014-02-19 13:48 ` [Qemu-devel] [PATCH 0/4] Tracetool cleanup Stefan Hajnoczi
  4 siblings, 0 replies; 10+ messages in thread
From: Lluís Vilanova @ 2014-02-17 19:36 UTC (permalink / raw)
  To: qemu-devel; +Cc: Kazuya Saito, Stefan Hajnoczi

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
---
 scripts/tracetool/format/__init__.py |   13 ++++++++++++-
 scripts/tracetool/format/c.py        |    3 +++
 scripts/tracetool/format/d.py        |    3 +++
 scripts/tracetool/format/events_c.py |    3 +++
 scripts/tracetool/format/events_h.py |    3 +++
 scripts/tracetool/format/h.py        |    3 +++
 scripts/tracetool/format/stap.py     |    5 ++++-
 7 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/scripts/tracetool/format/__init__.py b/scripts/tracetool/format/__init__.py
index 577a224..ddbcac9 100644
--- a/scripts/tracetool/format/__init__.py
+++ b/scripts/tracetool/format/__init__.py
@@ -17,6 +17,17 @@ considered its short description.
 All formats must generate their contents through the 'tracetool.out' routine.
 
 
+Format attributes
+-----------------
+
+========= =================================================================
+Attribute Description
+========= =================================================================
+API       If exists and is set to 'True', the format defines identifiers
+          (functions, variables, defines, etc.) directly used by QEMU code.
+========= =================================================================
+
+
 Format functions
 ----------------
 
@@ -34,7 +45,7 @@ nop      Called to generate the per-event contents when the event is disabled or
 """
 
 __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"
diff --git a/scripts/tracetool/format/c.py b/scripts/tracetool/format/c.py
index 930140b..8327dae 100644
--- a/scripts/tracetool/format/c.py
+++ b/scripts/tracetool/format/c.py
@@ -16,5 +16,8 @@ __email__      = "stefanha@linux.vnet.ibm.com"
 from tracetool import out
 
 
+API = False
+
+
 def begin(events):
     out('/* This file is autogenerated by tracetool, do not edit. */')
diff --git a/scripts/tracetool/format/d.py b/scripts/tracetool/format/d.py
index 74ee0d3..4d784d3 100644
--- a/scripts/tracetool/format/d.py
+++ b/scripts/tracetool/format/d.py
@@ -16,5 +16,8 @@ __email__      = "stefanha@linux.vnet.ibm.com"
 from tracetool import out
 
 
+API = False
+
+
 def begin(events):
     out('/* This file is autogenerated by tracetool, do not edit. */')
diff --git a/scripts/tracetool/format/events_c.py b/scripts/tracetool/format/events_c.py
index ea668ee..030dd37 100644
--- a/scripts/tracetool/format/events_c.py
+++ b/scripts/tracetool/format/events_c.py
@@ -16,6 +16,9 @@ __email__      = "stefanha@linux.vnet.ibm.com"
 from tracetool import out
 
 
+API = True
+
+
 def begin(events):
     out('/* This file is autogenerated by tracetool, do not edit. */',
         '',
diff --git a/scripts/tracetool/format/events_h.py b/scripts/tracetool/format/events_h.py
index f3febae..983f2b2 100644
--- a/scripts/tracetool/format/events_h.py
+++ b/scripts/tracetool/format/events_h.py
@@ -16,6 +16,9 @@ __email__      = "stefanha@linux.vnet.ibm.com"
 from tracetool import out
 
 
+API = True
+
+
 def begin(events):
     out('/* This file is autogenerated by tracetool, do not edit. */',
         '',
diff --git a/scripts/tracetool/format/h.py b/scripts/tracetool/format/h.py
index 85f011f..2809730 100644
--- a/scripts/tracetool/format/h.py
+++ b/scripts/tracetool/format/h.py
@@ -16,6 +16,9 @@ __email__      = "stefanha@linux.vnet.ibm.com"
 from tracetool import out
 
 
+API = True
+
+
 def begin(events):
     out('/* This file is autogenerated by tracetool, do not edit. */',
         '',
diff --git a/scripts/tracetool/format/stap.py b/scripts/tracetool/format/stap.py
index 50a4c69..134c197 100644
--- a/scripts/tracetool/format/stap.py
+++ b/scripts/tracetool/format/stap.py
@@ -6,7 +6,7 @@ Generate .stp file (DTrace with SystemTAP only).
 """
 
 __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"
@@ -16,5 +16,8 @@ __email__      = "stefanha@linux.vnet.ibm.com"
 from tracetool import out
 
 
+API = False
+
+
 def begin(events):
     out('/* This file is autogenerated by tracetool, do not edit. */')

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Qemu-devel] [PATCH 4/4] trace: [tracetool] Minimize the amount of per-backend code
  2014-02-17 19:36 [Qemu-devel] [PATCH 0/4] Tracetool cleanup Lluís Vilanova
                   ` (2 preceding siblings ...)
  2014-02-17 19:36 ` [Qemu-devel] [PATCH 3/4] trace: [tracetool] Identify formats directly used by QEMU Lluís Vilanova
@ 2014-02-17 19:36 ` Lluís Vilanova
  2014-02-19 13:37   ` Stefan Hajnoczi
  2014-02-19 13:48 ` [Qemu-devel] [PATCH 0/4] Tracetool cleanup Stefan Hajnoczi
  4 siblings, 1 reply; 10+ messages in thread
From: Lluís Vilanova @ 2014-02-17 19:36 UTC (permalink / raw)
  To: qemu-devel; +Cc: Kazuya Saito, Stefan Hajnoczi

Backends now only contain the essential backend-specific code, and most of the work is moved to frontend code.

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
---
 scripts/simpletrace.py                |    6 --
 scripts/tracetool/__init__.py         |   24 ++----
 scripts/tracetool/backend/__init__.py |   72 ++++++++----------
 scripts/tracetool/backend/dtrace.py   |   79 ++------------------
 scripts/tracetool/backend/events.py   |   23 ------
 scripts/tracetool/backend/ftrace.py   |   56 ++++++--------
 scripts/tracetool/backend/simple.py   |  130 ++++++++++++++++-----------------
 scripts/tracetool/backend/stderr.py   |   42 ++++-------
 scripts/tracetool/backend/ust.py      |   44 +++++------
 scripts/tracetool/format/__init__.py  |   46 ++++--------
 scripts/tracetool/format/c.py         |    9 ++
 scripts/tracetool/format/d.py         |   23 +++++-
 scripts/tracetool/format/events_c.py  |   11 +--
 scripts/tracetool/format/events_h.py  |   11 +--
 scripts/tracetool/format/h.py         |   24 ++++--
 scripts/tracetool/format/stap.py      |   37 +++++++++
 trace/Makefile.objs                   |    4 +
 17 files changed, 274 insertions(+), 367 deletions(-)
 delete mode 100644 scripts/tracetool/backend/events.py

diff --git a/scripts/simpletrace.py b/scripts/simpletrace.py
index 8bbcb42..03d032e 100755
--- a/scripts/simpletrace.py
+++ b/scripts/simpletrace.py
@@ -109,14 +109,10 @@ def process(events, log, analyzer):
     if isinstance(log, str):
         log = open(log, 'rb')
 
-    enabled_events = []
     dropped_event = Event.build("Dropped_Event(uint64_t num_events_dropped)")
     edict = {dropped_event_id: dropped_event}
 
-    for e in events:
-        if 'disable' not in e.properties:
-            enabled_events.append(e)
-    for num, event in enumerate(enabled_events):
+    for num, event in enumerate(events):
         edict[num] = event
 
     def build_fn(analyzer, event):
diff --git a/scripts/tracetool/__init__.py b/scripts/tracetool/__init__.py
index cca5072..fd705b6 100644
--- a/scripts/tracetool/__init__.py
+++ b/scripts/tracetool/__init__.py
@@ -261,10 +261,7 @@ def generate(fevents, format, backend,
     if not tracetool.backend.exists(backend):
         raise TracetoolError("unknown backend: %s" % backend)
     backend = backend.replace("-", "_")
-
-    if not tracetool.backend.compatible(backend, format):
-        raise TracetoolError("backend '%s' not compatible with format '%s'" %
-                             (backend, format))
+    backend = tracetool.backend.Wrapper(backend, format)
 
     import tracetool.backend.dtrace
     tracetool.backend.dtrace.BINARY = binary
@@ -272,16 +269,9 @@ def generate(fevents, format, backend,
 
     events = _read_events(fevents)
 
-    if backend == "nop":
-        ( e.properies.add("disable") for e in events )
-
-    tracetool.format.generate_begin(format, events)
-    tracetool.backend.generate("nop", format,
-                               [ e
-                                 for e in events
-                                 if "disable" in e.properties ])
-    tracetool.backend.generate(backend, format,
-                               [ e
-                                 for e in events
-                                 if "disable" not in e.properties ])
-    tracetool.format.generate_end(format, events)
+    # Except for QEMU's API, formats don't care about disabled events
+    format_api = tracetool.try_import("tracetool.frontend." + format,
+                                      "API", False)
+    if not format_api:
+        events = [e for e in events if "disable" not in e.properties]
+    tracetool.format.generate(events, format, backend)
diff --git a/scripts/tracetool/backend/__init__.py b/scripts/tracetool/backend/__init__.py
index 88f94fd..5e36f04 100644
--- a/scripts/tracetool/backend/__init__.py
+++ b/scripts/tracetool/backend/__init__.py
@@ -30,17 +30,24 @@ PUBLIC    If exists and is set to 'True', the backend is considered "public".
 Backend functions
 -----------------
 
-======== =======================================================================
-Function Description
-======== =======================================================================
-<format> Called to generate the format- and backend-specific code for each of
-         the specified events. If the function does not exist, the backend is
-         considered not compatible with the given format.
-======== =======================================================================
+All the following functions are optional, and no output will be generated if
+they do not exist.
+
+=============================== ==============================================
+Function                        Description
+=============================== ==============================================
+generate_<format>_begin(events) Generate backend- and format-specific file
+                                header contents.
+generate_<format>_end(events)   Generate backend- and format-specific file
+                                footer contents.
+generate_<format>(event)        Generate backend- and format-specific contents
+                                for the given event.
+=============================== ==============================================
+
 """
 
 __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"
@@ -91,39 +98,24 @@ def exists(name):
     return tracetool.try_import("tracetool.backend." + name)[1]
 
 
-def compatible(backend, format):
-    """Whether a backend is compatible with the given format."""
-    if not exists(backend):
-        raise ValueError("unknown backend: %s" % backend)
-
-    backend = backend.replace("-", "_")
-    format = format.replace("-", "_")
-
-    if backend == "nop":
-        return True
-    else:
-        func = tracetool.try_import("tracetool.backend." + backend,
-                                    format, None)[1]
-        return func is not None
-
-
-def _empty(events):
-    pass
+class Wrapper:
+    def __init__(self, backend, format):
+        self._backend = backend.replace("-", "_")
+        self._format = format.replace("-", "_")
+        assert exists(self._backend)
+        assert tracetool.format.exists(self._format)
 
-def generate(backend, format, events):
-    """Generate the per-event output for the given (backend, format) pair."""
-    if not compatible(backend, format):
-        raise ValueError("backend '%s' not compatible with format '%s'" %
-                         (backend, format))
+    def _run_function(self, name, *args, **kwargs):
+        func = tracetool.try_import("tracetool.backend." + self._backend,
+                                    name % self._format, None)[1]
+        if func is not None:
+            func(*args, **kwargs)
 
-    backend = backend.replace("-", "_")
-    format = format.replace("-", "_")
+    def generate_begin(self, events):
+        self._run_function("generate_%s_begin", events)
 
-    if backend == "nop":
-        func = tracetool.try_import("tracetool.format." + format,
-                                    "nop", _empty)[1]
-    else:
-        func = tracetool.try_import("tracetool.backend." + backend,
-                                    format, None)[1]
+    def generate(self, event):
+        self._run_function("generate_%s", event)
 
-    func(events)
+    def generate_end(self, events):
+        self._run_function("generate_%s_end", events)
diff --git a/scripts/tracetool/backend/dtrace.py b/scripts/tracetool/backend/dtrace.py
index 3c369c4..fabfe99 100644
--- a/scripts/tracetool/backend/dtrace.py
+++ b/scripts/tracetool/backend/dtrace.py
@@ -21,7 +21,7 @@ PUBLIC = True
 
 PROBEPREFIX = None
 
-def _probeprefix():
+def probeprefix():
     if PROBEPREFIX is None:
         raise ValueError("you must set PROBEPREFIX")
     return PROBEPREFIX
@@ -29,81 +29,18 @@ def _probeprefix():
 
 BINARY = None
 
-def _binary():
+def binary():
     if BINARY is None:
         raise ValueError("you must set BINARY")
     return BINARY
 
 
-def c(events):
-    pass
-
-
-def h(events):
+def generate_h_begin(events):
     out('#include "trace/generated-tracers-dtrace.h"',
         '')
 
-    for e in events:
-        out('static inline void %(api)s(%(args)s) {',
-            '    QEMU_%(uppername)s(%(argnames)s);',
-            '}',
-            api = e.api(),
-            args = e.args,
-            uppername = e.name.upper(),
-            argnames = ", ".join(e.args.names()),
-            )
-
-
-def d(events):
-    out('provider qemu {')
-
-    for e in events:
-        args = str(e.args)
-
-        # DTrace provider syntax expects foo() for empty
-        # params, not foo(void)
-        if args == 'void':
-            args = ''
-
-        # Define prototype for probe arguments
-        out('',
-            'probe %(name)s(%(args)s);',
-            name = e.name,
-            args = args,
-            )
-
-    out('',
-        '};')
-
-
-# Technically 'self' is not used by systemtap yet, but
-# they recommended we keep it in the reserved list anyway
-RESERVED_WORDS = (
-    'break', 'catch', 'continue', 'delete', 'else', 'for',
-    'foreach', 'function', 'global', 'if', 'in', 'limit',
-    'long', 'next', 'probe', 'return', 'self', 'string',
-    'try', 'while'
-    )
-
-def stap(events):
-    for e in events:
-        # Define prototype for probe arguments
-        out('probe %(probeprefix)s.%(name)s = process("%(binary)s").mark("%(name)s")',
-            '{',
-            probeprefix = _probeprefix(),
-            name = e.name,
-            binary = _binary(),
-            )
-
-        i = 1
-        if len(e.args) > 0:
-            for name in e.args.names():
-                # Append underscore to reserved keywords
-                if name in RESERVED_WORDS:
-                    name += '_'
-                out('  %s = $arg%d;' % (name, i))
-                i += 1
-
-        out('}')
-
-    out()
+
+def generate_h(event):
+    out('    QEMU_%(uppername)s(%(argnames)s);',
+        uppername=event.name.upper(),
+        argnames=", ".join(event.args.names()))
diff --git a/scripts/tracetool/backend/events.py b/scripts/tracetool/backend/events.py
deleted file mode 100644
index 5afce3e..0000000
--- a/scripts/tracetool/backend/events.py
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-"""
-Generic event description.
-
-This is a dummy backend to establish appropriate frontend/backend compatibility
-checks.
-"""
-
-__author__     = "Lluís Vilanova <vilanova@ac.upc.edu>"
-__copyright__  = "Copyright 2012, Lluís Vilanova <vilanova@ac.upc.edu>"
-__license__    = "GPL version 2 or (at your option) any later version"
-
-__maintainer__ = "Stefan Hajnoczi"
-__email__      = "stefanha@linux.vnet.ibm.com"
-
-
-def events_h(events):
-    pass
-
-def events_c(events):
-    pass
diff --git a/scripts/tracetool/backend/ftrace.py b/scripts/tracetool/backend/ftrace.py
index 888c361..d798c71 100644
--- a/scripts/tracetool/backend/ftrace.py
+++ b/scripts/tracetool/backend/ftrace.py
@@ -19,36 +19,30 @@ from tracetool import out
 PUBLIC = True
 
 
-def c(events):
-    pass
-
-def h(events):
+def generate_h_begin(events):
     out('#include "trace/ftrace.h"',
         '#include "trace/control.h"',
-        '',
-        )
-
-    for e in events:
-        argnames = ", ".join(e.args.names())
-        if len(e.args) > 0:
-            argnames = ", " + argnames
-
-        out('static inline void trace_%(name)s(%(args)s)',
-            '{',
-            '    char ftrace_buf[MAX_TRACE_STRLEN];',
-            '    int unused __attribute__ ((unused));',
-            '    int trlen;',
-            '    bool _state = trace_event_get_state(%(event_id)s);',
-            '    if (_state) {',
-            '        trlen = snprintf(ftrace_buf, MAX_TRACE_STRLEN,',
-            '                         "%(name)s " %(fmt)s "\\n" %(argnames)s);',
-            '        trlen = MIN(trlen, MAX_TRACE_STRLEN - 1);',
-            '        unused = write(trace_marker_fd, ftrace_buf, trlen);',
-            '    }',
-            '}',
-            name = e.name,
-            args = e.args,
-            event_id = "TRACE_" + e.name.upper(),
-            fmt = e.fmt.rstrip("\n"),
-            argnames = argnames,
-            )
+        '')
+
+
+def generate_h(event):
+    argnames = ", ".join(event.args.names())
+    if len(event.args) > 0:
+        argnames = ", " + argnames
+
+    out('    {',
+        '        char ftrace_buf[MAX_TRACE_STRLEN];',
+        '        int unused __attribute__ ((unused));',
+        '        int trlen;',
+        '        if (trace_event_get_state(%(event_id)s)) {',
+        '            trlen = snprintf(ftrace_buf, MAX_TRACE_STRLEN,',
+        '                             "%(name)s " %(fmt)s "\\n" %(argnames)s);',
+        '            trlen = MIN(trlen, MAX_TRACE_STRLEN - 1);',
+        '            unused = write(trace_marker_fd, ftrace_buf, trlen);',
+        '        }',
+        '    }',
+        name=event.name,
+        args=event.args,
+        event_id="TRACE_" + event.name.upper(),
+        fmt=event.fmt.rstrip("\n"),
+        argnames=argnames)
diff --git a/scripts/tracetool/backend/simple.py b/scripts/tracetool/backend/simple.py
index ca48e12..e8c2cd5 100644
--- a/scripts/tracetool/backend/simple.py
+++ b/scripts/tracetool/backend/simple.py
@@ -26,76 +26,74 @@ def is_string(arg):
     else:
         return False
 
-def c(events):
+
+def generate_h_begin(events):
+    for event in events:
+        out('void _simple_%(api)s(%(args)s);',
+            api=event.api(),
+            args=event.args)
+    out('')
+
+
+def generate_h(event):
+    out('    _simple_%(api)s(%(args)s);',
+        api=event.api(),
+        args=", ".join(event.args.names()))
+
+
+def generate_c_begin(events):
     out('#include "trace.h"',
         '#include "trace/control.h"',
         '#include "trace/simple.h"',
+        '')
+
+
+def generate_c(event):
+    out('void _simple_%(api)s(%(args)s)',
+        '{',
+        '    TraceBufferRecord rec;',
+        api=event.api(),
+        args=event.args)
+    sizes = []
+    for type_, name in event.args:
+        if is_string(type_):
+            out('    size_t arg%(name)s_len = %(name)s ? MIN(strlen(%(name)s), MAX_TRACE_STRLEN) : 0;',
+                name=name)
+            strsizeinfo = "4 + arg%s_len" % name
+            sizes.append(strsizeinfo)
+        else:
+            sizes.append("8")
+    sizestr = " + ".join(sizes)
+    if len(event.args) == 0:
+        sizestr = '0'
+
+
+    out('',
+        '    if (!trace_event_get_state(%(event_id)s)) {',
+        '        return;',
+        '    }',
         '',
-        )
-
-    for num, event in enumerate(events):
-        out('void %(api)s(%(args)s)',
-            '{',
-            '    TraceBufferRecord rec;',
-            api = event.api(),
-            args = event.args,
-            )
-        sizes = []
+        '    if (trace_record_start(&rec, %(event_id)s, %(size_str)s)) {',
+        '        return; /* Trace Buffer Full, Event Dropped ! */',
+        '    }',
+        event_id='TRACE_' + event.name.upper(),
+        size_str=sizestr)
+
+    if len(event.args) > 0:
         for type_, name in event.args:
+            # string
             if is_string(type_):
-                out('    size_t arg%(name)s_len = %(name)s ? MIN(strlen(%(name)s), MAX_TRACE_STRLEN) : 0;',
-                    name = name,
-                   )
-                strsizeinfo = "4 + arg%s_len" % name
-                sizes.append(strsizeinfo)
+                out('    trace_record_write_str(&rec, %(name)s, arg%(name)s_len);',
+                    name=name)
+            # pointer var (not string)
+            elif type_.endswith('*'):
+                out('    trace_record_write_u64(&rec, (uintptr_t)(uint64_t *)%(name)s);',
+                    name=name)
+            # primitive data type
             else:
-                sizes.append("8")
-        sizestr = " + ".join(sizes)
-        if len(event.args) == 0:
-            sizestr = '0'
-
-
-        out('',
-            '    TraceEvent *eventp = trace_event_id(%(event_enum)s);',
-            '    bool _state = trace_event_get_state_dynamic(eventp);',
-            '    if (!_state) {',
-            '        return;',
-            '    }',
-            '',
-            '    if (trace_record_start(&rec, %(event_id)s, %(size_str)s)) {',
-            '        return; /* Trace Buffer Full, Event Dropped ! */',
-            '    }',
-            event_enum = 'TRACE_' + event.name.upper(),
-            event_id = num,
-            size_str = sizestr,
-            )
-
-        if len(event.args) > 0:
-            for type_, name in event.args:
-                # string
-                if is_string(type_):
-                    out('    trace_record_write_str(&rec, %(name)s, arg%(name)s_len);',
-                        name = name,
-                       )
-                # pointer var (not string)
-                elif type_.endswith('*'):
-                    out('    trace_record_write_u64(&rec, (uintptr_t)(uint64_t *)%(name)s);',
-                        name = name,
-                       )
-                # primitive data type
-                else:
-                    out('    trace_record_write_u64(&rec, (uint64_t)%(name)s);',
-                       name = name,
-                       )
-
-        out('    trace_record_finish(&rec);',
-            '}',
-            '')
-
-
-def h(events):
-    for event in events:
-        out('void %(api)s(%(args)s);',
-            api = event.api(),
-            args = event.args,
-            )
+                out('    trace_record_write_u64(&rec, (uint64_t)%(name)s);',
+                   name=name)
+
+    out('    trace_record_finish(&rec);',
+        '}',
+        '')
diff --git a/scripts/tracetool/backend/stderr.py b/scripts/tracetool/backend/stderr.py
index 6681e26..2a1e906 100644
--- a/scripts/tracetool/backend/stderr.py
+++ b/scripts/tracetool/backend/stderr.py
@@ -19,31 +19,21 @@ from tracetool import out
 PUBLIC = True
 
 
-def c(events):
-    pass
-
-def h(events):
+def generate_h_begin(events):
     out('#include <stdio.h>',
         '#include "trace/control.h"',
-        '',
-        )
-
-    for e in events:
-        argnames = ", ".join(e.args.names())
-        if len(e.args) > 0:
-            argnames = ", " + argnames
-
-        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(),
-            fmt = e.fmt.rstrip("\n"),
-            argnames = argnames,
-            )
+        '')
+
+
+def generate_h(event):
+    argnames = ", ".join(event.args.names())
+    if len(event.args) > 0:
+        argnames = ", " + argnames
+
+    out('    if (trace_event_get_state(%(event_id)s)) {',
+        '        fprintf(stderr, "%(name)s " %(fmt)s "\\n" %(argnames)s);',
+        '    }',
+        event_id="TRACE_" + event.name.upper(),
+        name=event.name,
+        fmt=event.fmt.rstrip("\n"),
+        argnames=argnames)
diff --git a/scripts/tracetool/backend/ust.py b/scripts/tracetool/backend/ust.py
index 180b1bf..86038d9 100644
--- a/scripts/tracetool/backend/ust.py
+++ b/scripts/tracetool/backend/ust.py
@@ -19,7 +19,7 @@ from tracetool import out
 PUBLIC = True
 
 
-def c(events):
+def generate_c_begin(events):
     out('#include <ust/marker.h>',
         '#undef mutex_lock',
         '#undef mutex_unlock',
@@ -41,8 +41,7 @@ def c(events):
                 name = e.name,
                 args = e.args,
                 fmt = e.fmt,
-                argnames = argnames,
-                )
+                argnames = argnames)
 
         else:
             out('DEFINE_TRACE(ust_%(name)s);',
@@ -52,8 +51,7 @@ def c(events):
                 '    trace_mark(ust, %(name)s, UST_MARKER_NOARGS);',
                 '}',
                 name = e.name,
-                args = e.args,
-                )
+                args = e.args)
 
     # register probes
     out('',
@@ -62,34 +60,30 @@ def c(events):
 
     for e in events:
         out('    register_trace_ust_%(name)s(ust_%(name)s_probe);',
-            name = e.name,
-            )
+            name = e.name)
 
     out('}')
 
 
-def h(events):
+def generate_h_begin(events):
     out('#include <ust/tracepoint.h>',
         '#undef mutex_lock',
         '#undef mutex_unlock',
         '#undef inline',
         '#undef wmb')
 
-    for e in events:
-        if len(e.args) > 0:
-            out('DECLARE_TRACE(ust_%(name)s, TP_PROTO(%(args)s), TP_ARGS(%(argnames)s));',
-                '#define %(api)s trace_ust_%(name)s',
-                api = e.api(),
-                name = e.name,
-                args = e.args,
-                argnames = ", ".join(e.args.names()),
-                )
-
-        else:
-            out('_DECLARE_TRACEPOINT_NOARGS(ust_%(name)s);',
-                '#define %(api)s trace_ust_%(name)s',
-                api = e.api(),
-                name = e.name,
-                )
 
-    out()
+def generate_h(event):
+    if len(event.args) > 0:
+        out('DECLARE_TRACE(ust_%(name)s, TP_PROTO(%(args)s), TP_ARGS(%(argnames)s));',
+            '#define %(api)s trace_ust_%(name)s',
+            api=event.api(),
+            name=event.name,
+            args=event.args,
+            argnames=", ".join(event.args.names()))
+
+    else:
+        out('_DECLARE_TRACEPOINT_NOARGS(ust_%(name)s);',
+            '#define %(api)s trace_ust_%(name)s',
+            api=event.api(),
+            name=event.name)
diff --git a/scripts/tracetool/format/__init__.py b/scripts/tracetool/format/__init__.py
index ddbcac9..b738abc 100644
--- a/scripts/tracetool/format/__init__.py
+++ b/scripts/tracetool/format/__init__.py
@@ -31,17 +31,12 @@ API       If exists and is set to 'True', the format defines identifiers
 Format functions
 ----------------
 
-All the following functions are optional, and no output will be generated if
-they do not exist.
-
-======== =======================================================================
+======== ==================================================================
 Function Description
-======== =======================================================================
-begin    Called to generate the format-specific file header.
-end      Called to generate the format-specific file footer.
-nop      Called to generate the per-event contents when the event is disabled or
-         the selected backend is 'nop'.
-======== =======================================================================
+======== ==================================================================
+generate Called to generate a format-specific file.
+======== ==================================================================
+
 """
 
 __author__     = "Lluís Vilanova <vilanova@ac.upc.edu>"
@@ -90,25 +85,12 @@ def exists(name):
     return tracetool.try_import("tracetool.format." + name)[1]
 
 
-def _empty(events):
-    pass
-
-def generate_begin(name, events):
-    """Generate the header of the format-specific file."""
-    if not exists(name):
-        raise ValueError("unknown format: %s" % name)
-
-    name = name.replace("-", "_")
-    func = tracetool.try_import("tracetool.format." + name,
-                                "begin", _empty)[1]
-    func(events)
-
-def generate_end(name, events):
-    """Generate the footer of the format-specific file."""
-    if not exists(name):
-        raise ValueError("unknown format: %s" % name)
-
-    name = name.replace("-", "_")
-    func = tracetool.try_import("tracetool.format." + name,
-                                "end", _empty)[1]
-    func(events)
+def generate(events, format, backend):
+    if not exists(format):
+        raise ValueError("unknown format: %s" % format)
+    format = format.replace("-", "_")
+    func = tracetool.try_import("tracetool.format." + format,
+                                "generate")[1]
+    if func is None:
+        raise AttributeError("format has no 'generate': %s" % format)
+    func(events, backend)
diff --git a/scripts/tracetool/format/c.py b/scripts/tracetool/format/c.py
index 8327dae..c12d25f 100644
--- a/scripts/tracetool/format/c.py
+++ b/scripts/tracetool/format/c.py
@@ -19,5 +19,10 @@ from tracetool import out
 API = False
 
 
-def begin(events):
-    out('/* This file is autogenerated by tracetool, do not edit. */')
+def generate(events, backend):
+    out('/* This file is autogenerated by tracetool, do not edit. */',
+        '')
+    backend.generate_begin(events)
+    for event in events:
+        backend.generate(event)
+    backend.generate_end(events)
diff --git a/scripts/tracetool/format/d.py b/scripts/tracetool/format/d.py
index 4d784d3..80c7090 100644
--- a/scripts/tracetool/format/d.py
+++ b/scripts/tracetool/format/d.py
@@ -19,5 +19,24 @@ from tracetool import out
 API = False
 
 
-def begin(events):
-    out('/* This file is autogenerated by tracetool, do not edit. */')
+def generate(events, backend):
+    out('/* This file is autogenerated by tracetool, do not edit. */'
+        '',
+        'provider qemu {')
+
+    for e in events:
+        args = str(e.args)
+
+        # DTrace provider syntax expects foo() for empty
+        # params, not foo(void)
+        if args == 'void':
+            args = ''
+
+        # Define prototype for probe arguments
+        out('',
+            'probe %(name)s(%(args)s);',
+            name=e.name,
+            args=args)
+
+    out('',
+        '};')
diff --git a/scripts/tracetool/format/events_c.py b/scripts/tracetool/format/events_c.py
index 030dd37..03cd14b 100644
--- a/scripts/tracetool/format/events_c.py
+++ b/scripts/tracetool/format/events_c.py
@@ -19,14 +19,13 @@ from tracetool import out
 API = True
 
 
-def begin(events):
+def generate(events, backend):
     out('/* This file is autogenerated by tracetool, do not edit. */',
         '',
         '#include "trace.h"',
         '#include "trace/generated-events.h"',
         '#include "trace/control.h"',
-        '',
-        )
+        '')
 
     out('TraceEvent trace_events[TRACE_EVENT_COUNT] = {')
 
@@ -34,9 +33,7 @@ def begin(events):
         out('    { .id = %(id)s, .name = \"%(name)s\", .sstate = %(sstate)s, .dstate = 0 },',
             id = "TRACE_" + e.name.upper(),
             name = e.name,
-            sstate = "TRACE_%s_ENABLED" % e.name.upper(),
-            )
+            sstate = "TRACE_%s_ENABLED" % e.name.upper())
 
     out('};',
-        '',
-        )
+        '')
diff --git a/scripts/tracetool/format/events_h.py b/scripts/tracetool/format/events_h.py
index 983f2b2..a56aef6 100644
--- a/scripts/tracetool/format/events_h.py
+++ b/scripts/tracetool/format/events_h.py
@@ -19,15 +19,14 @@ from tracetool import out
 API = True
 
 
-def begin(events):
+def generate(events, backend):
     out('/* This file is autogenerated by tracetool, do not edit. */',
         '',
         '#ifndef TRACE__GENERATED_EVENTS_H',
         '#define TRACE__GENERATED_EVENTS_H',
         '',
         '#include <stdbool.h>',
-        ''
-        )
+        '')
 
     # event identifiers
     out('typedef enum {')
@@ -36,8 +35,7 @@ def begin(events):
         out('    TRACE_%s,' % e.name.upper())
 
     out('    TRACE_EVENT_COUNT',
-        '} TraceEventID;',
-        )
+        '} TraceEventID;')
 
     # static state
     for e in events:
@@ -49,5 +47,4 @@ def begin(events):
 
     out('#include "trace/event-internal.h"',
         '',
-        '#endif  /* TRACE__GENERATED_EVENTS_H */',
-        )
+        '#endif  /* TRACE__GENERATED_EVENTS_H */')
diff --git a/scripts/tracetool/format/h.py b/scripts/tracetool/format/h.py
index 2809730..a8b9ac3 100644
--- a/scripts/tracetool/format/h.py
+++ b/scripts/tracetool/format/h.py
@@ -19,23 +19,29 @@ from tracetool import out
 API = True
 
 
-def begin(events):
+def generate(events, backend):
     out('/* This file is autogenerated by tracetool, do not edit. */',
         '',
         '#ifndef TRACE__GENERATED_TRACERS_H',
         '#define TRACE__GENERATED_TRACERS_H',
         '',
-        '#include "qemu-common.h"')
+        '#include "qemu-common.h"',
+        '')
 
-def end(events):
-    out('#endif /* TRACE__GENERATED_TRACERS_H */')
+    backend.generate_begin(events)
 
-def nop(events):
     for e in events:
         out('',
             'static inline void %(api)s(%(args)s)',
             '{',
-            '}',
-            api = e.api(),
-            args = e.args,
-            )
+            api=e.api(),
+            args=e.args)
+
+        if "disable" not in e.properties:
+            backend.generate(e)
+
+        out('}')
+
+    backend.generate_end(events)
+
+    out('#endif /* TRACE__GENERATED_TRACERS_H */')
diff --git a/scripts/tracetool/format/stap.py b/scripts/tracetool/format/stap.py
index 134c197..42847ab 100644
--- a/scripts/tracetool/format/stap.py
+++ b/scripts/tracetool/format/stap.py
@@ -14,10 +14,43 @@ __email__      = "stefanha@linux.vnet.ibm.com"
 
 
 from tracetool import out
+from tracetool.backend.dtrace import binary, probeprefix
 
 
 API = False
 
 
-def begin(events):
-    out('/* This file is autogenerated by tracetool, do not edit. */')
+# Technically 'self' is not used by systemtap yet, but
+# they recommended we keep it in the reserved list anyway
+RESERVED_WORDS = (
+    'break', 'catch', 'continue', 'delete', 'else', 'for',
+    'foreach', 'function', 'global', 'if', 'in', 'limit',
+    'long', 'next', 'probe', 'return', 'self', 'string',
+    'try', 'while'
+    )
+
+
+def generate(events, backend):
+    out('/* This file is autogenerated by tracetool, do not edit. */',
+        '')
+
+    for e in events:
+        # Define prototype for probe arguments
+        out('probe %(probeprefix)s.%(name)s = process("%(binary)s").mark("%(name)s")',
+            '{',
+            probeprefix=probeprefix(),
+            name=e.name,
+            binary=binary())
+
+        i = 1
+        if len(e.args) > 0:
+            for name in e.args.names():
+                # Append underscore to reserved keywords
+                if name in RESERVED_WORDS:
+                    name += '_'
+                out('  %s = $arg%d;' % (name, i))
+                i += 1
+
+        out('}')
+
+    out()
diff --git a/trace/Makefile.objs b/trace/Makefile.objs
index 3b88e49..68d905b 100644
--- a/trace/Makefile.objs
+++ b/trace/Makefile.objs
@@ -7,7 +7,7 @@ $(obj)/generated-events.h: $(obj)/generated-events.h-timestamp
 $(obj)/generated-events.h-timestamp: $(SRC_PATH)/trace-events
 	$(call quiet-command,$(TRACETOOL) \
 		--format=events-h \
-		--backend=events \
+		--backend=$(TRACE_BACKEND) \
 		< $< > $@,"  GEN   $(patsubst %-timestamp,%,$@)")
 	@cmp -s $@ $(patsubst %-timestamp,%,$@) || cp $@ $(patsubst %-timestamp,%,$@)
 
@@ -15,7 +15,7 @@ $(obj)/generated-events.c: $(obj)/generated-events.c-timestamp $(BUILD_DIR)/conf
 $(obj)/generated-events.c-timestamp: $(SRC_PATH)/trace-events
 	$(call quiet-command,$(TRACETOOL) \
 		--format=events-c \
-		--backend=events \
+		--backend=$(TRACE_BACKEND) \
 		< $< > $@,"  GEN   $(patsubst %-timestamp,%,$@)")
 	@cmp -s $@ $(patsubst %-timestamp,%,$@) || cp $@ $(patsubst %-timestamp,%,$@)
 

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [PATCH 4/4] trace: [tracetool] Minimize the amount of per-backend code
  2014-02-17 19:36 ` [Qemu-devel] [PATCH 4/4] trace: [tracetool] Minimize the amount of per-backend code Lluís Vilanova
@ 2014-02-19 13:37   ` Stefan Hajnoczi
  0 siblings, 0 replies; 10+ messages in thread
From: Stefan Hajnoczi @ 2014-02-19 13:37 UTC (permalink / raw)
  To: Lluís Vilanova; +Cc: qemu-devel, Kazuya Saito

On Mon, Feb 17, 2014 at 08:36:41PM +0100, Lluís Vilanova wrote:
> Backends now only contain the essential backend-specific code, and most of the work is moved to frontend code.
> 
> Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
> ---
>  scripts/simpletrace.py                |    6 --
>  scripts/tracetool/__init__.py         |   24 ++----
>  scripts/tracetool/backend/__init__.py |   72 ++++++++----------
>  scripts/tracetool/backend/dtrace.py   |   79 ++------------------
>  scripts/tracetool/backend/events.py   |   23 ------
>  scripts/tracetool/backend/ftrace.py   |   56 ++++++--------
>  scripts/tracetool/backend/simple.py   |  130 ++++++++++++++++-----------------
>  scripts/tracetool/backend/stderr.py   |   42 ++++-------
>  scripts/tracetool/backend/ust.py      |   44 +++++------
>  scripts/tracetool/format/__init__.py  |   46 ++++--------
>  scripts/tracetool/format/c.py         |    9 ++
>  scripts/tracetool/format/d.py         |   23 +++++-
>  scripts/tracetool/format/events_c.py  |   11 +--
>  scripts/tracetool/format/events_h.py  |   11 +--
>  scripts/tracetool/format/h.py         |   24 ++++--
>  scripts/tracetool/format/stap.py      |   37 +++++++++
>  trace/Makefile.objs                   |    4 +
>  17 files changed, 274 insertions(+), 367 deletions(-)
>  delete mode 100644 scripts/tracetool/backend/events.py

Please split the coding style changes into a separate commit (e.g.
removing trailing commas).

> diff --git a/scripts/simpletrace.py b/scripts/simpletrace.py
> index 8bbcb42..03d032e 100755
> --- a/scripts/simpletrace.py
> +++ b/scripts/simpletrace.py
> @@ -109,14 +109,10 @@ def process(events, log, analyzer):
>      if isinstance(log, str):
>          log = open(log, 'rb')
>  
> -    enabled_events = []
>      dropped_event = Event.build("Dropped_Event(uint64_t num_events_dropped)")
>      edict = {dropped_event_id: dropped_event}
>  
> -    for e in events:
> -        if 'disable' not in e.properties:
> -            enabled_events.append(e)
> -    for num, event in enumerate(enabled_events):
> +    for num, event in enumerate(events):
>          edict[num] = event
>  
>      def build_fn(analyzer, event):

This patch breaks existing simpletrace files.  Imagine you are
developing code and use simpletrace.  Then you decide to rebase onto the
latest qemu.git/master.  This patch changes the semantics - now
simpletrace.py outputs junk when analyzing the existing file.

We can't break the file format for convenience.  Either bump the file
format version number or don't change the semantics.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [PATCH 0/4] Tracetool cleanup
  2014-02-17 19:36 [Qemu-devel] [PATCH 0/4] Tracetool cleanup Lluís Vilanova
                   ` (3 preceding siblings ...)
  2014-02-17 19:36 ` [Qemu-devel] [PATCH 4/4] trace: [tracetool] Minimize the amount of per-backend code Lluís Vilanova
@ 2014-02-19 13:48 ` Stefan Hajnoczi
  2014-02-19 15:19   ` Lluís Vilanova
  4 siblings, 1 reply; 10+ messages in thread
From: Stefan Hajnoczi @ 2014-02-19 13:48 UTC (permalink / raw)
  To: Lluís Vilanova; +Cc: qemu-devel, Kazuya Saito

On Mon, Feb 17, 2014 at 08:36:19PM +0100, Lluís Vilanova wrote:
> Minimizes the amount of backend code, making it simpler to add new/different
> backends.
> 
> Also performs other cleanups all around.
> 
> Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
> ---
> 
> Lluís Vilanova (4):
>       trace: [tracetool] Add method 'Event.api' to build event names
>       trace: [tracetool,trivial] Style changes
>       trace: [tracetool] Identify formats directly used by QEMU
>       trace: [tracetool] Minimize the amount of per-backend code

I think we stretched the concepts of backends and formats too far.
There are formats that only work with one backend (like 'stap').  And
there are backends that behave differently from all other backends.

As a result we're trying to abstract and make common a bunch of stuff
that isn't really common.  This problem existed before this patch
series, but I feel we're going further down a direction that
increasingly seems to be wrong.

It's simpler if we turn the design inside-out.  Instead of making
backends export all sorts of interfaces and flags, tracetool should just
parse trace-events and hand the list over to the backend.

Let the backend do whatever it wants.  The format option simply becomes
an option telling the backend which type of output to generate
(events.h, events.c, .stp, etc).

Common behavior should live in plain old Python modules/functions.

TL;DR moving to a library design would simplify and clean up more than
trying to improve the current framework design

What do you think?

Stefan

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [PATCH 0/4] Tracetool cleanup
  2014-02-19 13:48 ` [Qemu-devel] [PATCH 0/4] Tracetool cleanup Stefan Hajnoczi
@ 2014-02-19 15:19   ` Lluís Vilanova
  2014-02-20 10:20     ` Stefan Hajnoczi
  0 siblings, 1 reply; 10+ messages in thread
From: Lluís Vilanova @ 2014-02-19 15:19 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: qemu-devel, Kazuya Saito

Stefan Hajnoczi writes:

> On Mon, Feb 17, 2014 at 08:36:19PM +0100, Lluís Vilanova wrote:
>> Minimizes the amount of backend code, making it simpler to add new/different
>> backends.
>> 
>> Also performs other cleanups all around.
>> 
>> Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
>> ---
>> 
>> Lluís Vilanova (4):
>> trace: [tracetool] Add method 'Event.api' to build event names
>> trace: [tracetool,trivial] Style changes
>> trace: [tracetool] Identify formats directly used by QEMU
>> trace: [tracetool] Minimize the amount of per-backend code

> I think we stretched the concepts of backends and formats too far.
> There are formats that only work with one backend (like 'stap').  And
> there are backends that behave differently from all other backends.

> As a result we're trying to abstract and make common a bunch of stuff
> that isn't really common.  This problem existed before this patch
> series, but I feel we're going further down a direction that
> increasingly seems to be wrong.

> It's simpler if we turn the design inside-out.  Instead of making
> backends export all sorts of interfaces and flags, tracetool should just
> parse trace-events and hand the list over to the backend.

> Let the backend do whatever it wants.  The format option simply becomes
> an option telling the backend which type of output to generate
> (events.h, events.c, .stp, etc).

> Common behavior should live in plain old Python modules/functions.

> TL;DR moving to a library design would simplify and clean up more than
> trying to improve the current framework design

> What do you think?

This series moves into that direction; some of the formats are simply not
handled by backends. For example, the "stap", "events_c" and "events_h" formats
have no backend-specific contents.

Also, having common code for the "format", and then relying on backends for a
small piece of the contents simplifies later patches like the multi-backend
tracing.

The thing here is that maybe we should change format to "file", since it
actually refers to a specific output file.


Thanks,
  Lluis

-- 
 "And it's much the same thing with knowledge, for whenever you learn
 something new, the whole world becomes that much richer."
 -- The Princess of Pure Reason, as told by Norton Juster in The Phantom
 Tollbooth

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [PATCH 0/4] Tracetool cleanup
  2014-02-19 15:19   ` Lluís Vilanova
@ 2014-02-20 10:20     ` Stefan Hajnoczi
  2014-02-20 13:39       ` Lluís Vilanova
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Hajnoczi @ 2014-02-20 10:20 UTC (permalink / raw)
  To: Stefan Hajnoczi, qemu-devel, Kazuya Saito

On Wed, Feb 19, 2014 at 04:19:10PM +0100, Lluís Vilanova wrote:
> Stefan Hajnoczi writes:
> 
> > On Mon, Feb 17, 2014 at 08:36:19PM +0100, Lluís Vilanova wrote:
> >> Minimizes the amount of backend code, making it simpler to add new/different
> >> backends.
> >> 
> >> Also performs other cleanups all around.
> >> 
> >> Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
> >> ---
> >> 
> >> Lluís Vilanova (4):
> >> trace: [tracetool] Add method 'Event.api' to build event names
> >> trace: [tracetool,trivial] Style changes
> >> trace: [tracetool] Identify formats directly used by QEMU
> >> trace: [tracetool] Minimize the amount of per-backend code
> 
> > I think we stretched the concepts of backends and formats too far.
> > There are formats that only work with one backend (like 'stap').  And
> > there are backends that behave differently from all other backends.
> 
> > As a result we're trying to abstract and make common a bunch of stuff
> > that isn't really common.  This problem existed before this patch
> > series, but I feel we're going further down a direction that
> > increasingly seems to be wrong.
> 
> > It's simpler if we turn the design inside-out.  Instead of making
> > backends export all sorts of interfaces and flags, tracetool should just
> > parse trace-events and hand the list over to the backend.
> 
> > Let the backend do whatever it wants.  The format option simply becomes
> > an option telling the backend which type of output to generate
> > (events.h, events.c, .stp, etc).
> 
> > Common behavior should live in plain old Python modules/functions.
> 
> > TL;DR moving to a library design would simplify and clean up more than
> > trying to improve the current framework design
> 
> > What do you think?
> 
> This series moves into that direction; some of the formats are simply not
> handled by backends. For example, the "stap", "events_c" and "events_h" formats
> have no backend-specific contents.
> 
> Also, having common code for the "format", and then relying on backends for a
> small piece of the contents simplifies later patches like the multi-backend
> tracing.
> 
> The thing here is that maybe we should change format to "file", since it
> actually refers to a specific output file.

You have a point.  tracetool needs to output a particular file (e.g.
generated-events.c, generated-tracers.h), which is kind of what a
"format" has become.

So the "format" is the primary piece of code that emits output.  But if
it needs to do something backend-specific (like generated-tracers.h)
then it should call into backend modules.

I am still concerned about the weird and wonderful interfaces that we're
creating (like the "API" field in this patch series).  They make it
harder to understand the code and add new backends.  Will think about
this more when reviewing the next revision of this series.

Stefan

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [PATCH 0/4] Tracetool cleanup
  2014-02-20 10:20     ` Stefan Hajnoczi
@ 2014-02-20 13:39       ` Lluís Vilanova
  0 siblings, 0 replies; 10+ messages in thread
From: Lluís Vilanova @ 2014-02-20 13:39 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: qemu-devel, Stefan Hajnoczi, Kazuya Saito

Stefan Hajnoczi writes:

> On Wed, Feb 19, 2014 at 04:19:10PM +0100, Lluís Vilanova wrote:
>> Stefan Hajnoczi writes:
>> 
>> > On Mon, Feb 17, 2014 at 08:36:19PM +0100, Lluís Vilanova wrote:
>> >> Minimizes the amount of backend code, making it simpler to add new/different
>> >> backends.
>> >> 
>> >> Also performs other cleanups all around.
>> >> 
>> >> Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
>> >> ---
>> >> 
>> >> Lluís Vilanova (4):
>> >> trace: [tracetool] Add method 'Event.api' to build event names
>> >> trace: [tracetool,trivial] Style changes
>> >> trace: [tracetool] Identify formats directly used by QEMU
>> >> trace: [tracetool] Minimize the amount of per-backend code
>> 
>> > I think we stretched the concepts of backends and formats too far.
>> > There are formats that only work with one backend (like 'stap').  And
>> > there are backends that behave differently from all other backends.
>> 
>> > As a result we're trying to abstract and make common a bunch of stuff
>> > that isn't really common.  This problem existed before this patch
>> > series, but I feel we're going further down a direction that
>> > increasingly seems to be wrong.
>> 
>> > It's simpler if we turn the design inside-out.  Instead of making
>> > backends export all sorts of interfaces and flags, tracetool should just
>> > parse trace-events and hand the list over to the backend.
>> 
>> > Let the backend do whatever it wants.  The format option simply becomes
>> > an option telling the backend which type of output to generate
>> > (events.h, events.c, .stp, etc).
>> 
>> > Common behavior should live in plain old Python modules/functions.
>> 
>> > TL;DR moving to a library design would simplify and clean up more than
>> > trying to improve the current framework design
>> 
>> > What do you think?
>> 
>> This series moves into that direction; some of the formats are simply not
>> handled by backends. For example, the "stap", "events_c" and "events_h" formats
>> have no backend-specific contents.
>> 
>> Also, having common code for the "format", and then relying on backends for a
>> small piece of the contents simplifies later patches like the multi-backend
>> tracing.
>> 
>> The thing here is that maybe we should change format to "file", since it
>> actually refers to a specific output file.

> You have a point.  tracetool needs to output a particular file (e.g.
> generated-events.c, generated-tracers.h), which is kind of what a
> "format" has become.

> So the "format" is the primary piece of code that emits output.  But if
> it needs to do something backend-specific (like generated-tracers.h)
> then it should call into backend modules.

Exactly.


> I am still concerned about the weird and wonderful interfaces that we're
> creating (like the "API" field in this patch series).  They make it
> harder to understand the code and add new backends.  Will think about
> this more when reviewing the next revision of this series.

Right. To be honest, the "API" sounded like a nice idea when I wrote it, but the
only thing it buys you is that non-API formats will only receive non-disabled
events. A really small benefit for adding more inter-module semantics. I will
probably remove it after rebasing the series.


Thanks,
  Lluis

-- 
 "And it's much the same thing with knowledge, for whenever you learn
 something new, the whole world becomes that much richer."
 -- The Princess of Pure Reason, as told by Norton Juster in The Phantom
 Tollbooth

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2014-02-20 13:39 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-17 19:36 [Qemu-devel] [PATCH 0/4] Tracetool cleanup Lluís Vilanova
2014-02-17 19:36 ` [Qemu-devel] [PATCH 1/4] trace: [tracetool] Add method 'Event.api' to build event names Lluís Vilanova
2014-02-17 19:36 ` [Qemu-devel] [PATCH 2/4] trace: [tracetool,trivial] Style changes Lluís Vilanova
2014-02-17 19:36 ` [Qemu-devel] [PATCH 3/4] trace: [tracetool] Identify formats directly used by QEMU Lluís Vilanova
2014-02-17 19:36 ` [Qemu-devel] [PATCH 4/4] trace: [tracetool] Minimize the amount of per-backend code Lluís Vilanova
2014-02-19 13:37   ` Stefan Hajnoczi
2014-02-19 13:48 ` [Qemu-devel] [PATCH 0/4] Tracetool cleanup Stefan Hajnoczi
2014-02-19 15:19   ` Lluís Vilanova
2014-02-20 10:20     ` Stefan Hajnoczi
2014-02-20 13:39       ` Lluís Vilanova

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.