mirror of
https://github.com/qemu/qemu.git
synced 2024-11-25 11:53:39 +08:00
trace: [tracetool] Add method 'Event.api' to build event names
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>
This commit is contained in:
parent
9898370497
commit
7d08f0da90
@ -6,7 +6,7 @@ Machinery for generating tracing-related intermediate files.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
__author__ = "Lluís Vilanova <vilanova@ac.upc.edu>"
|
__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"
|
__license__ = "GPL version 2 or (at your option) any later version"
|
||||||
|
|
||||||
__maintainer__ = "Stefan Hajnoczi"
|
__maintainer__ = "Stefan Hajnoczi"
|
||||||
@ -173,6 +173,14 @@ class Event(object):
|
|||||||
self.args,
|
self.args,
|
||||||
self.fmt)
|
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):
|
def _read_events(fobj):
|
||||||
res = []
|
res = []
|
||||||
for line in fobj:
|
for line in fobj:
|
||||||
|
@ -6,7 +6,7 @@ DTrace/SystemTAP backend.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
__author__ = "Lluís Vilanova <vilanova@ac.upc.edu>"
|
__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"
|
__license__ = "GPL version 2 or (at your option) any later version"
|
||||||
|
|
||||||
__maintainer__ = "Stefan Hajnoczi"
|
__maintainer__ = "Stefan Hajnoczi"
|
||||||
@ -44,10 +44,10 @@ def h(events):
|
|||||||
'')
|
'')
|
||||||
|
|
||||||
for e in 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);',
|
' QEMU_%(uppername)s(%(argnames)s);',
|
||||||
'}',
|
'}',
|
||||||
name = e.name,
|
api = e.api(),
|
||||||
args = e.args,
|
args = e.args,
|
||||||
uppername = e.name.upper(),
|
uppername = e.name.upper(),
|
||||||
argnames = ", ".join(e.args.names()),
|
argnames = ", ".join(e.args.names()),
|
||||||
|
@ -6,7 +6,7 @@ Simple built-in backend.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
__author__ = "Lluís Vilanova <vilanova@ac.upc.edu>"
|
__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"
|
__license__ = "GPL version 2 or (at your option) any later version"
|
||||||
|
|
||||||
__maintainer__ = "Stefan Hajnoczi"
|
__maintainer__ = "Stefan Hajnoczi"
|
||||||
@ -34,10 +34,10 @@ def c(events):
|
|||||||
)
|
)
|
||||||
|
|
||||||
for num, event in enumerate(events):
|
for num, event in enumerate(events):
|
||||||
out('void trace_%(name)s(%(args)s)',
|
out('void %(api)s(%(args)s)',
|
||||||
'{',
|
'{',
|
||||||
' TraceBufferRecord rec;',
|
' TraceBufferRecord rec;',
|
||||||
name = event.name,
|
api = event.api(),
|
||||||
args = event.args,
|
args = event.args,
|
||||||
)
|
)
|
||||||
sizes = []
|
sizes = []
|
||||||
@ -95,7 +95,7 @@ def c(events):
|
|||||||
|
|
||||||
def h(events):
|
def h(events):
|
||||||
for event in events:
|
for event in events:
|
||||||
out('void trace_%(name)s(%(args)s);',
|
out('void %(api)s(%(args)s);',
|
||||||
name = event.name,
|
api = event.api(),
|
||||||
args = event.args,
|
args = event.args,
|
||||||
)
|
)
|
||||||
|
@ -6,7 +6,7 @@ Stderr built-in backend.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
__author__ = "Lluís Vilanova <vilanova@ac.upc.edu>"
|
__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"
|
__license__ = "GPL version 2 or (at your option) any later version"
|
||||||
|
|
||||||
__maintainer__ = "Stefan Hajnoczi"
|
__maintainer__ = "Stefan Hajnoczi"
|
||||||
@ -33,13 +33,14 @@ def h(events):
|
|||||||
if len(e.args) > 0:
|
if len(e.args) > 0:
|
||||||
argnames = ", " + argnames
|
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);',
|
' bool _state = trace_event_get_state(%(event_id)s);',
|
||||||
' if (_state) {',
|
' if (_state) {',
|
||||||
' fprintf(stderr, "%(name)s " %(fmt)s "\\n" %(argnames)s);',
|
' fprintf(stderr, "%(name)s " %(fmt)s "\\n" %(argnames)s);',
|
||||||
' }',
|
' }',
|
||||||
'}',
|
'}',
|
||||||
|
api = e.api(),
|
||||||
name = e.name,
|
name = e.name,
|
||||||
args = e.args,
|
args = e.args,
|
||||||
event_id = "TRACE_" + e.name.upper(),
|
event_id = "TRACE_" + e.name.upper(),
|
||||||
|
@ -6,7 +6,7 @@ LTTng User Space Tracing backend.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
__author__ = "Lluís Vilanova <vilanova@ac.upc.edu>"
|
__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"
|
__license__ = "GPL version 2 or (at your option) any later version"
|
||||||
|
|
||||||
__maintainer__ = "Stefan Hajnoczi"
|
__maintainer__ = "Stefan Hajnoczi"
|
||||||
@ -31,11 +31,12 @@ def h(events):
|
|||||||
if len(e.args) > 0:
|
if len(e.args) > 0:
|
||||||
argnames = ", " + argnames
|
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);',
|
' tracepoint(qemu, %(name)s%(tp_args)s);',
|
||||||
'}',
|
'}',
|
||||||
'',
|
'',
|
||||||
|
api = e.api()
|
||||||
name = e.name,
|
name = e.name,
|
||||||
args = e.args,
|
args = e.args,
|
||||||
tp_args = argnames,
|
tp_args = argnames,
|
||||||
@ -79,4 +80,4 @@ def ust_events_h(events):
|
|||||||
')',
|
')',
|
||||||
'',
|
'',
|
||||||
name = e.name,
|
name = e.name,
|
||||||
)
|
)
|
||||||
|
@ -6,7 +6,7 @@ Generate .h file.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
__author__ = "Lluís Vilanova <vilanova@ac.upc.edu>"
|
__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"
|
__license__ = "GPL version 2 or (at your option) any later version"
|
||||||
|
|
||||||
__maintainer__ = "Stefan Hajnoczi"
|
__maintainer__ = "Stefan Hajnoczi"
|
||||||
@ -30,9 +30,9 @@ def end(events):
|
|||||||
def nop(events):
|
def nop(events):
|
||||||
for e in events:
|
for e in events:
|
||||||
out('',
|
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,
|
args = e.args,
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user