Tracing patches
I forgot to open the QEMU 2.1 tracing queue. Let's get started!
The following changes since commit 9898370497da3f18e0c9555b65c858eabc78ab50:
Merge remote-tracking branch 'remotes/kraxel/tags/pull-smbios-2' into staging (2014-05-06 12:23:05 +0100)
are available in the git repository at:
git://github.com/stefanha/qemu.git tags/tracing-pull-request
for you to fetch changes up to e00e36fb913217d49f57cc19d8d605270dd82bc5:
configure: Show trace output file conditionally (2014-05-07 19:07:18 +0200)
----------------------------------------------------------------
Tracing pull request
----------------------------------------------------------------
Lluís Vilanova (8):
trace: [tracetool] Add method 'Event.api' to build event names
trace: [tracetool] Add methods 'Event.copy' and 'Arguments.copy'
trace: [tracetool] Spacing changes
trace: [tracetool] Cosmetic changes
trace: [tracetool] Show list of frontends and backends sorted by name
trace: [tracetool] Change format docs to point to the generated file
trace: [simple] Bump up log version number
trace: [tracetool] Minimize the amount of per-backend code
Stefan Weil (1):
configure: Show trace output file conditionally
configure | 2 + scripts/simpletrace.py | 16 ++-- 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 | 65 +++------------ scripts/tracetool/format/__init__.py | 50 ++++-------- scripts/tracetool/format/c.py | 16 +++- scripts/tracetool/format/d.py | 30 ++++++- scripts/tracetool/format/events_c.py | 15 ++-- scripts/tracetool/format/events_h.py | 15 ++-- scripts/tracetool/format/h.py | 30 ++++--- scripts/tracetool/format/stap.py | 42 +++++++++- scripts/tracetool/format/ust_events_c.py | 7 +- scripts/tracetool/format/ust_events_h.py | 42 +++++++++- trace/Makefile.objs | 4 +- trace/simple.c | 2 +- 21 files changed, 364 insertions(+), 434 deletions(-) delete mode 100644 scripts/tracetool/backend/events.py
Signature · 1 line
1.9.0
[Qemu-devel] [PULL 1/9] trace: [tracetool] Add method 'Event.api' to build event names
From: Lluís Vilanova <[email protected]>
Makes it easier to ensure proper naming across the different frontends and backends.
--- 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(-)
scripts/tracetool/__init__.py +9 -1
@@ -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:
scripts/tracetool/backend/dtrace.py +3 -3
@@ -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()),
scripts/tracetool/backend/simple.py +5 -5
@@ -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, )
scripts/tracetool/backend/stderr.py +3 -2
@@ -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(),
scripts/tracetool/backend/ust.py +4 -3
@@ -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, - ) + )
scripts/tracetool/format/h.py +3 -3
@@ -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, )
Signature · 1 line
1.9.0
[Qemu-devel] [PULL 2/9] trace: [tracetool] Add methods 'Event.copy' and 'Arguments.copy'
In reply to Stefan HajnocziFrom: Lluís Vilanova <[email protected]>
--- scripts/tracetool/__init__.py | 9 +++++++++ 1 file changed, 9 insertions(+)
scripts/tracetool/__init__.py +9 -0
@@ -52,6 +52,10 @@ class Arguments: """ self._args = args + def copy(self): + """Create a new copy.""" + return Arguments(list(self._args)) + @staticmethod def build(arg_str): """Build and Arguments instance from an argument string.
@@ -146,6 +150,11 @@ class Event(object): if len(unknown_props) > 0: raise ValueError("Unknown properties: %s" % ", ".join(unknown_props)) + def copy(self): + """Create a new copy.""" + return Event(self.name, list(self.properties), self.fmt, + self.args.copy(), self) + @staticmethod def build(line_str): """Build an Event instance from a string.
Signature · 1 line
1.9.0
[Qemu-devel] [PULL 4/9] trace: [tracetool] Cosmetic changes
In reply to Stefan HajnocziFrom: Lluís Vilanova <[email protected]>
--- scripts/tracetool/__init__.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
scripts/tracetool/__init__.py +7 -7
@@ -256,18 +256,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))
@@ -280,7 +280,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
@@ -289,4 +289,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)
Signature · 1 line
1.9.0
[Qemu-devel] [PULL 6/9] trace: [tracetool] Change format docs to point to the generated file
In reply to Stefan HajnocziFrom: Lluís Vilanova <[email protected]>
--- 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 +- scripts/tracetool/format/ust_events_c.py | 2 +- scripts/tracetool/format/ust_events_h.py | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-)
scripts/tracetool/format/c.py +2 -2
@@ -2,11 +2,11 @@ # -*- coding: utf-8 -*- """ -Generate .c file. +trace/generated-tracers.c """ __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"
scripts/tracetool/format/d.py +2 -2
@@ -2,11 +2,11 @@ # -*- coding: utf-8 -*- """ -Generate .d file (DTrace only). +trace/generated-tracers.dtrace (DTrace only). """ __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"
scripts/tracetool/format/events_c.py +2 -2
@@ -2,11 +2,11 @@ # -*- coding: utf-8 -*- """ -Generate .c for event description. +trace/generated-events.c """ __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"
scripts/tracetool/format/events_h.py +2 -2
@@ -2,11 +2,11 @@ # -*- coding: utf-8 -*- """ -Generate .h for event description. +trace/generated-events.h """ __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"
scripts/tracetool/format/h.py +1 -1
@@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- """ -Generate .h file. +trace/generated-tracers.h """ __author__ = "Lluís Vilanova <[email protected]>"
scripts/tracetool/format/ust_events_c.py +1 -1
@@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- """ -Generate .c for LTTng ust event description. +trace/generated-ust.c """ __author__ = "Mohamad Gebai <[email protected]>"
scripts/tracetool/format/ust_events_h.py +1 -1
@@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- """ -Generate .h for LTTng ust event description. +trace/generated-ust-provider.h """ __author__ = "Mohamad Gebai <[email protected]>"
Signature · 1 line
1.9.0
[Qemu-devel] [PULL 5/9] trace: [tracetool] Show list of frontends and backends sorted by name
In reply to Stefan HajnocziFrom: Lluís Vilanova <[email protected]>
--- scripts/tracetool/backend/__init__.py | 2 +- scripts/tracetool/format/__init__.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
scripts/tracetool/backend/__init__.py +1 -1
@@ -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
scripts/tracetool/format/__init__.py +2 -2
@@ -34,7 +34,7 @@ nop Called to generate the per-event contents when the event is disabled or """ __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"
@@ -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
Signature · 1 line
1.9.0
[Qemu-devel] [PULL 7/9] trace: [simple] Bump up log version number
In reply to Stefan HajnocziFrom: Lluís Vilanova <[email protected]>
The following tracetool cleanup changes the event numbering policy.
--- scripts/simpletrace.py | 10 +++++----- trace/simple.c | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-)
scripts/simpletrace.py +5 -5
@@ -65,13 +65,13 @@ def read_trace_file(edict, fobj): header[0] != header_event_id or \ header[1] != header_magic: raise ValueError('Not a valid trace file!') - if header[2] != 0 and \ - header[2] != 2: - raise ValueError('Unknown version of tracelog format!') log_version = header[2] - if log_version == 0: - raise ValueError('Older log format, not supported with this QEMU release!') + if log_version not in [0, 2, 3]: + raise ValueError('Unknown version of tracelog format!') + if log_version != 3: + raise ValueError('Log format %d not supported with this QEMU release!' + % log_version) while True: rec = read_record(edict, fobj)
trace/simple.c +1 -1
@@ -28,7 +28,7 @@#define HEADER_MAGIC 0xf2b177cb0aa429b4ULL/** Trace file version number, bump if format changes */ -#define HEADER_VERSION 2 +#define HEADER_VERSION 3/** Records were dropped event ID */ #define DROPPED_EVENT_ID (~(uint64_t)0 - 1)
Signature · 1 line
1.9.0
[Qemu-devel] [PULL 8/9] trace: [tracetool] Minimize the amount of per-backend code
In reply to Stefan HajnocziFrom: Lluís Vilanova <[email protected]>
Backends now only contain the essential backend-specific code, and most of the work is moved to frontend code.
--- scripts/simpletrace.py | 6 +- scripts/tracetool/__init__.py | 19 +---- 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 | 64 ++------------- scripts/tracetool/format/__init__.py | 46 ++++------- scripts/tracetool/format/c.py | 12 ++- scripts/tracetool/format/d.py | 26 ++++++- 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 | 42 +++++++++- scripts/tracetool/format/ust_events_c.py | 5 +- scripts/tracetool/format/ust_events_h.py | 40 +++++++++- trace/Makefile.objs | 4 +- 19 files changed, 310 insertions(+), 402 deletions(-) delete mode 100644 scripts/tracetool/backend/events.py
scripts/simpletrace.py +1 -5
@@ -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):
scripts/tracetool/__init__.py +2 -17
@@ -266,10 +266,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
@@ -277,16 +274,4 @@ 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) + tracetool.format.generate(events, format, backend)
scripts/tracetool/backend/__init__.py +32 -40
88 lines not on this page · raw message
scripts/tracetool/backend/dtrace.py +8 -71
96 lines not on this page · raw message
scripts/tracetool/backend/events.py deleted +0 -23
@@ -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 <[email protected]>" -__copyright__ = "Copyright 2012, Lluís Vilanova <[email protected]>" -__license__ = "GPL version 2 or (at your option) any later version" - -__maintainer__ = "Stefan Hajnoczi" -__email__ = "[email protected]" - - -def events_h(events): - pass - -def events_c(events): - pass
scripts/tracetool/backend/ftrace.py +25 -31
61 lines not on this page · raw message
scripts/tracetool/backend/simple.py +64 -66
140 lines not on this page · raw message
scripts/tracetool/backend/stderr.py +16 -26
47 lines not on this page · raw message
scripts/tracetool/backend/ust.py +8 -56
74 lines not on this page · raw message
scripts/tracetool/format/__init__.py +14 -32
56 lines not on this page · raw message
scripts/tracetool/format/c.py +10 -2
@@ -16,5 +16,13 @@ __email__ = "[email protected]" from tracetool import out -def begin(events): - out('/* This file is autogenerated by tracetool, do not edit. */') +def generate(events, backend): + events = [e for e in events + if "disable" not in e.properties] + + 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)
scripts/tracetool/format/d.py +24 -2
@@ -16,5 +16,27 @@ __email__ = "[email protected]" from tracetool import out -def begin(events): - out('/* This file is autogenerated by tracetool, do not edit. */') +def generate(events, backend): + events = [e for e in events + if "disable" not in e.properties] + + 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('', + '};')
scripts/tracetool/format/events_c.py +4 -7
@@ -16,14 +16,13 @@ __email__ = "[email protected]" from tracetool import out -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] = {')
@@ -31,9 +30,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('};', - '', - ) + '')
scripts/tracetool/format/events_h.py +4 -7
@@ -16,15 +16,14 @@ __email__ = "[email protected]" from tracetool import out -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 {')
@@ -33,8 +32,7 @@ def begin(events): out(' TRACE_%s,' % e.name.upper()) out(' TRACE_EVENT_COUNT', - '} TraceEventID;', - ) + '} TraceEventID;') # static state for e in events:
@@ -46,5 +44,4 @@ def begin(events): out('#include "trace/event-internal.h"', '', - '#endif /* TRACE__GENERATED_EVENTS_H */', - ) + '#endif /* TRACE__GENERATED_EVENTS_H */')
scripts/tracetool/format/h.py +15 -9
@@ -16,23 +16,29 @@ __email__ = "[email protected]" from tracetool import out -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 */')
scripts/tracetool/format/stap.py +39 -3
53 lines not on this page · raw message
scripts/tracetool/format/ust_events_c.py +4 -1
@@ -16,7 +16,10 @@ __email__ = "[email protected]" from tracetool import out -def begin(events): +def generate(events, backend): + events = [e for e in events + if "disabled" not in e.properties] + out('/* This file is autogenerated by tracetool, do not edit. */', '', '#define TRACEPOINT_DEFINE',
scripts/tracetool/format/ust_events_h.py +38 -2
@@ -16,7 +16,10 @@ __email__ = "[email protected]" from tracetool import out -def begin(events): +def generate(events, backend): + events = [e for e in events + if "disabled" not in e.properties] + out('/* This file is autogenerated by tracetool, do not edit. */', '', '#undef TRACEPOINT_PROVIDER',
@@ -50,7 +53,40 @@ def begin(events): '#endif', '') -def end(events): + for e in events: + if len(e.args) > 0: + out('TRACEPOINT_EVENT(', + ' qemu,', + ' %(name)s,', + ' TP_ARGS(%(args)s),', + ' TP_FIELDS(', + name=e.name, + args=", ".join(", ".join(i) for i in e.args)) + + for t, n in e.args: + if ('int' in t) or ('long' in t) or ('unsigned' in t) or ('size_t' in t): + out(' ctf_integer(' + t + ', ' + n + ', ' + n + ')') + elif ('double' in t) or ('float' in t): + out(' ctf_float(' + t + ', ' + n + ', ' + n + ')') + elif ('char *' in t) or ('char*' in t): + out(' ctf_string(' + n + ', ' + n + ')') + elif ('void *' in t) or ('void*' in t): + out(' ctf_integer_hex(unsigned long, ' + n + ', ' + n + ')') + + out(' )', + ')', + '') + + else: + out('TRACEPOINT_EVENT(', + ' qemu,', + ' %(name)s,', + ' TP_ARGS(void),', + ' TP_FIELDS()', + ')', + '', + name=e.name) + out('#endif /* TRACE__GENERATED_UST_H */', '', '/* This part must be outside ifdef protection */',
trace/Makefile.objs +2 -2
@@ -31,7 +31,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,%,$@)
@@ -39,7 +39,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,%,$@)
Signature · 1 line
1.9.0
[Qemu-devel] [PULL 3/9] trace: [tracetool] Spacing changes
In reply to Stefan HajnocziFrom: Lluís Vilanova <[email protected]>
--- scripts/tracetool/__init__.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
scripts/tracetool/__init__.py +4 -3
@@ -148,7 +148,8 @@ 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(self): """Create a new copy."""
@@ -206,7 +207,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
@@ -233,7 +234,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
Signature · 1 line
1.9.0
[Qemu-devel] [PULL 9/9] configure: Show trace output file conditionally
In reply to Stefan HajnocziFrom: Stefan Weil <[email protected]>
It is only used with the simple trace backend.
--- configure | 2 ++ 1 file changed, 2 insertions(+)
configure +2 -0
@@ -4145,7 +4145,9 @@ echo "libcap-ng support $cap_ng" echo "vhost-net support $vhost_net" echo "vhost-scsi support $vhost_scsi" echo "Trace backend $trace_backend" +if test "$trace_backend" = "simple"; then echo "Trace output file $trace_file-<pid>" +fi if test "$spice" = "yes"; then echo "spice support $spice ($spice_protocol_version/$spice_server_version)" else
Signature · 1 line
1.9.0
Peter Maydell
AppliedQuoted 6 lines · Stefan Hajnoczi
I forgot to open the QEMU 2.1 tracing queue. Let's get started!
The following changes since commit
9898370497da3f18e0c9555b65c858eabc78ab50:Merge remote-tracking branch 'remotes/kraxel/tags/pull-smbios-2' into staging (2014-05-06 12:23:05 +0100)
Quoted 8 lines
are available in the git repository at:
git://github.com/stefanha/qemu.gittags/tracing-pull-requestfor you to fetch changes up to
e00e36fb913217d49f57cc19d8d605270dd82bc5:configure: Show trace output file conditionally (2014-05-07 19:07:18 +0200)
Applied, thanks.
-- PMM