]> Git Repo - qemu.git/commitdiff
trace: [tracetool] Add method 'Event.api' to build event names
authorLluís Vilanova <[email protected]>
Sun, 23 Feb 2014 19:37:02 +0000 (20:37 +0100)
committerStefan Hajnoczi <[email protected]>
Wed, 7 May 2014 17:07:17 +0000 (19:07 +0200)
Makes it easier to ensure proper naming across the different frontends and backends.

Signed-off-by: Lluís Vilanova <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
scripts/tracetool/__init__.py
scripts/tracetool/backend/dtrace.py
scripts/tracetool/backend/simple.py
scripts/tracetool/backend/stderr.py
scripts/tracetool/backend/ust.py
scripts/tracetool/format/h.py

index 175df0800529c80272479e8e210ebbffd4c7cd52..305b99e4b902871c6256b3cc5be318f4ac184431 100644 (file)
@@ -6,7 +6,7 @@ Machinery for generating tracing-related intermediate files.
 """
 
 __author__     = "Lluís Vilanova <[email protected]>"
-__copyright__  = "Copyright 2012, Lluís Vilanova <[email protected]>"
+__copyright__  = "Copyright 2012-2014, Lluís Vilanova <[email protected]>"
 __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:
index e31bc799f81177cd25416dc2bc26a8e6edcc7b10..3c369c47801e445aad00213bf9321334cde53311 100644 (file)
@@ -6,7 +6,7 @@ DTrace/SystemTAP backend.
 """
 
 __author__     = "Lluís Vilanova <[email protected]>"
-__copyright__  = "Copyright 2012, Lluís Vilanova <[email protected]>"
+__copyright__  = "Copyright 2012-2014, Lluís Vilanova <[email protected]>"
 __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()),
index 3dde372e466a1a14305b07ab5485be667f3ab668..ca48e1236fbcadc470c6959d3ac2611a615aefdf 100644 (file)
@@ -6,7 +6,7 @@ Simple built-in backend.
 """
 
 __author__     = "Lluís Vilanova <[email protected]>"
-__copyright__  = "Copyright 2012, Lluís Vilanova <[email protected]>"
+__copyright__  = "Copyright 2012-2014, Lluís Vilanova <[email protected]>"
 __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,
             )
index 6f93dbd1ae36a9048331291db90571ca5b9600a0..6681e26ff929f13bf32b7d5f483d0969a1ae36ce 100644 (file)
@@ -6,7 +6,7 @@ Stderr built-in backend.
 """
 
 __author__     = "Lluís Vilanova <[email protected]>"
-__copyright__  = "Copyright 2012, Lluís Vilanova <[email protected]>"
+__copyright__  = "Copyright 2012-2014, Lluís Vilanova <[email protected]>"
 __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(),
index 41c1c75b7c8ce25971b9156e45a179c415f89943..2fca4d2c819ec9e4c2ea335ed116529af8e87a89 100644 (file)
@@ -6,7 +6,7 @@ LTTng User Space Tracing backend.
 """
 
 __author__     = "Lluís Vilanova <[email protected]>"
-__copyright__  = "Copyright 2012, Lluís Vilanova <[email protected]>"
+__copyright__  = "Copyright 2012-2014, Lluís Vilanova <[email protected]>"
 __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
+                )
index 93132fceafe21f6fb8b6e35d65f8917e6ec97971..9b0903d6f9d44bcc3505f628b283073aeffd90a6 100644 (file)
@@ -6,7 +6,7 @@ Generate .h file.
 """
 
 __author__     = "Lluís Vilanova <[email protected]>"
-__copyright__  = "Copyright 2012, Lluís Vilanova <[email protected]>"
+__copyright__  = "Copyright 2012-2014, Lluís Vilanova <[email protected]>"
 __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,
             )
This page took 0.041023 seconds and 4 git commands to generate.