summaryrefslogtreecommitdiff
path: root/scripts/tracetool
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/tracetool')
-rw-r--r--scripts/tracetool/__init__.py28
-rw-r--r--scripts/tracetool/backend/__init__.py12
-rw-r--r--scripts/tracetool/backend/dtrace.py4
-rw-r--r--scripts/tracetool/backend/ftrace.py5
-rw-r--r--scripts/tracetool/backend/log.py7
-rw-r--r--scripts/tracetool/backend/simple.py15
-rw-r--r--scripts/tracetool/backend/syslog.py44
-rw-r--r--scripts/tracetool/backend/ust.py4
-rw-r--r--scripts/tracetool/format/__init__.py4
-rw-r--r--scripts/tracetool/format/c.py56
-rw-r--r--scripts/tracetool/format/d.py2
-rw-r--r--scripts/tracetool/format/events_c.py44
-rw-r--r--scripts/tracetool/format/events_h.py60
-rw-r--r--scripts/tracetool/format/h.py37
-rw-r--r--scripts/tracetool/format/simpletrace_stap.py26
-rw-r--r--scripts/tracetool/format/stap.py2
-rw-r--r--scripts/tracetool/format/tcg_h.py8
-rw-r--r--scripts/tracetool/format/tcg_helper_c.py2
-rw-r--r--scripts/tracetool/format/tcg_helper_h.py2
-rw-r--r--scripts/tracetool/format/tcg_helper_wrapper_h.py2
-rw-r--r--scripts/tracetool/format/ust_events_c.py2
-rw-r--r--scripts/tracetool/format/ust_events_h.py9
22 files changed, 204 insertions, 171 deletions
diff --git a/scripts/tracetool/__init__.py b/scripts/tracetool/__init__.py
index be24039c5e..365446fa53 100644
--- a/scripts/tracetool/__init__.py
+++ b/scripts/tracetool/__init__.py
@@ -265,11 +265,13 @@ class Event(object):
QEMU_TRACE = "trace_%(name)s"
QEMU_TRACE_TCG = QEMU_TRACE + "_tcg"
+ QEMU_DSTATE = "_TRACE_%(NAME)s_DSTATE"
+ QEMU_EVENT = "_TRACE_%(NAME)s_EVENT"
def api(self, fmt=None):
if fmt is None:
fmt = Event.QEMU_TRACE
- return fmt % {"name": self.name}
+ return fmt % {"name": self.name, "NAME": self.name.upper()}
def transform(self, *trans):
"""Return a new Event with transformed Arguments."""
@@ -280,7 +282,17 @@ class Event(object):
self)
-def _read_events(fobj):
+def read_events(fobj):
+ """Generate the output for the given (format, backends) pair.
+
+ Parameters
+ ----------
+ fobj : file
+ Event description file.
+
+ Returns a list of Event objects
+ """
+
events = []
for line in fobj:
if not line.strip():
@@ -352,14 +364,16 @@ def try_import(mod_name, attr_name=None, attr_default=None):
return False, None
-def generate(fevents, format, backends,
+def generate(events, group, format, backends,
binary=None, probe_prefix=None):
"""Generate the output for the given (format, backends) pair.
Parameters
----------
- fevents : file
- Event description file.
+ events : list
+ list of Event objects to generate for
+ group: str
+ Name of the tracing group
format : str
Output format name.
backends : list
@@ -389,6 +403,4 @@ def generate(fevents, format, backends,
tracetool.backend.dtrace.BINARY = binary
tracetool.backend.dtrace.PROBEPREFIX = probe_prefix
- events = _read_events(fevents)
-
- tracetool.format.generate(events, format, backend)
+ tracetool.format.generate(events, format, backend, group)
diff --git a/scripts/tracetool/backend/__init__.py b/scripts/tracetool/backend/__init__.py
index d4b6dab9ca..f735a259c0 100644
--- a/scripts/tracetool/backend/__init__.py
+++ b/scripts/tracetool/backend/__init__.py
@@ -113,11 +113,11 @@ class Wrapper:
if func is not None:
func(*args, **kwargs)
- def generate_begin(self, events):
- self._run_function("generate_%s_begin", events)
+ def generate_begin(self, events, group):
+ self._run_function("generate_%s_begin", events, group)
- def generate(self, event):
- self._run_function("generate_%s", event)
+ def generate(self, event, group):
+ self._run_function("generate_%s", event, group)
- def generate_end(self, events):
- self._run_function("generate_%s_end", events)
+ def generate_end(self, events, group):
+ self._run_function("generate_%s_end", events, group)
diff --git a/scripts/tracetool/backend/dtrace.py b/scripts/tracetool/backend/dtrace.py
index ab9ecfab30..79505c6b1a 100644
--- a/scripts/tracetool/backend/dtrace.py
+++ b/scripts/tracetool/backend/dtrace.py
@@ -35,12 +35,12 @@ def binary():
return BINARY
-def generate_h_begin(events):
+def generate_h_begin(events, group):
out('#include "trace/generated-tracers-dtrace.h"',
'')
-def generate_h(event):
+def generate_h(event, group):
out(' QEMU_%(uppername)s(%(argnames)s);',
uppername=event.name.upper(),
argnames=", ".join(event.args.names()))
diff --git a/scripts/tracetool/backend/ftrace.py b/scripts/tracetool/backend/ftrace.py
index 80dcf30478..db9fe7ad57 100644
--- a/scripts/tracetool/backend/ftrace.py
+++ b/scripts/tracetool/backend/ftrace.py
@@ -19,13 +19,12 @@ from tracetool import out
PUBLIC = True
-def generate_h_begin(events):
+def generate_h_begin(events, group):
out('#include "trace/ftrace.h"',
- '#include "trace/control.h"',
'')
-def generate_h(event):
+def generate_h(event, group):
argnames = ", ".join(event.args.names())
if len(event.args) > 0:
argnames = ", " + argnames
diff --git a/scripts/tracetool/backend/log.py b/scripts/tracetool/backend/log.py
index b3ff064011..4f4a4d38b1 100644
--- a/scripts/tracetool/backend/log.py
+++ b/scripts/tracetool/backend/log.py
@@ -19,13 +19,12 @@ from tracetool import out
PUBLIC = True
-def generate_h_begin(events):
- out('#include "trace/control.h"',
- '#include "qemu/log.h"',
+def generate_h_begin(events, group):
+ out('#include "qemu/log.h"',
'')
-def generate_h(event):
+def generate_h(event, group):
argnames = ", ".join(event.args.names())
if len(event.args) > 0:
argnames = ", " + argnames
diff --git a/scripts/tracetool/backend/simple.py b/scripts/tracetool/backend/simple.py
index 1bccada63d..85f61028e2 100644
--- a/scripts/tracetool/backend/simple.py
+++ b/scripts/tracetool/backend/simple.py
@@ -21,13 +21,14 @@ PUBLIC = True
def is_string(arg):
strtype = ('const char*', 'char*', 'const char *', 'char *')
- if arg.lstrip().startswith(strtype):
+ arg_strip = arg.lstrip()
+ if arg_strip.startswith(strtype) and arg_strip.count('*') == 1:
return True
else:
return False
-def generate_h_begin(events):
+def generate_h_begin(events, group):
for event in events:
out('void _simple_%(api)s(%(args)s);',
api=event.api(),
@@ -35,13 +36,13 @@ def generate_h_begin(events):
out('')
-def generate_h(event):
+def generate_h(event, group):
out(' _simple_%(api)s(%(args)s);',
api=event.api(),
args=", ".join(event.args.names()))
-def generate_c_begin(events):
+def generate_c_begin(events, group):
out('#include "qemu/osdep.h"',
'#include "trace.h"',
'#include "trace/control.h"',
@@ -49,7 +50,7 @@ def generate_c_begin(events):
'')
-def generate_c(event):
+def generate_c(event, group):
out('void _simple_%(api)s(%(args)s)',
'{',
' TraceBufferRecord rec;',
@@ -80,11 +81,11 @@ def generate_c(event):
' return;',
' }',
'',
- ' if (trace_record_start(&rec, %(event_id)s, %(size_str)s)) {',
+ ' if (trace_record_start(&rec, %(event_obj)s.id, %(size_str)s)) {',
' return; /* Trace Buffer Full, Event Dropped ! */',
' }',
cond=cond,
- event_id=event_id,
+ event_obj=event.api(event.QEMU_EVENT),
size_str=sizestr)
if len(event.args) > 0:
diff --git a/scripts/tracetool/backend/syslog.py b/scripts/tracetool/backend/syslog.py
new file mode 100644
index 0000000000..b8ff2790c4
--- /dev/null
+++ b/scripts/tracetool/backend/syslog.py
@@ -0,0 +1,44 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+"""
+Syslog built-in backend.
+"""
+
+__author__ = "Paul Durrant <paul.durrant@citrix.com>"
+__copyright__ = "Copyright 2016, Citrix Systems Inc."
+__license__ = "GPL version 2 or (at your option) any later version"
+
+__maintainer__ = "Stefan Hajnoczi"
+__email__ = "stefanha@redhat.com"
+
+
+from tracetool import out
+
+
+PUBLIC = True
+
+
+def generate_h_begin(events, group):
+ out('#include <syslog.h>',
+ '')
+
+
+def generate_h(event, group):
+ argnames = ", ".join(event.args.names())
+ if len(event.args) > 0:
+ argnames = ", " + argnames
+
+ if "vcpu" in event.properties:
+ # already checked on the generic format code
+ cond = "true"
+ else:
+ cond = "trace_event_get_state(%s)" % ("TRACE_" + event.name.upper())
+
+ out(' if (%(cond)s) {',
+ ' syslog(LOG_INFO, "%(name)s " %(fmt)s %(argnames)s);',
+ ' }',
+ cond=cond,
+ 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 ed4c227f69..4594db6128 100644
--- a/scripts/tracetool/backend/ust.py
+++ b/scripts/tracetool/backend/ust.py
@@ -19,13 +19,13 @@ from tracetool import out
PUBLIC = True
-def generate_h_begin(events):
+def generate_h_begin(events, group):
out('#include <lttng/tracepoint.h>',
'#include "trace/generated-ust-provider.h"',
'')
-def generate_h(event):
+def generate_h(event, group):
argnames = ", ".join(event.args.names())
if len(event.args) > 0:
argnames = ", " + argnames
diff --git a/scripts/tracetool/format/__init__.py b/scripts/tracetool/format/__init__.py
index 812570ff6f..cf6e0e2da5 100644
--- a/scripts/tracetool/format/__init__.py
+++ b/scripts/tracetool/format/__init__.py
@@ -74,7 +74,7 @@ def exists(name):
return tracetool.try_import("tracetool.format." + name)[1]
-def generate(events, format, backend):
+def generate(events, format, backend, group):
if not exists(format):
raise ValueError("unknown format: %s" % format)
format = format.replace("-", "_")
@@ -82,4 +82,4 @@ def generate(events, format, backend):
"generate")[1]
if func is None:
raise AttributeError("format has no 'generate': %s" % format)
- func(events, backend)
+ func(events, backend, group)
diff --git a/scripts/tracetool/format/c.py b/scripts/tracetool/format/c.py
index 699598fb02..47115ed8af 100644
--- a/scripts/tracetool/format/c.py
+++ b/scripts/tracetool/format/c.py
@@ -16,13 +16,55 @@ __email__ = "stefanha@linux.vnet.ibm.com"
from tracetool import out
-def generate(events, backend):
- events = [e for e in events
- if "disable" not in e.properties]
+def generate(events, backend, group):
+ active_events = [e for e in events
+ if "disable" not in e.properties]
out('/* This file is autogenerated by tracetool, do not edit. */',
+ '',
+ '#include "qemu/osdep.h"',
+ '#include "trace.h"',
'')
- backend.generate_begin(events)
- for event in events:
- backend.generate(event)
- backend.generate_end(events)
+
+ for e in events:
+ out('uint16_t %s;' % e.api(e.QEMU_DSTATE))
+
+ for e in events:
+ if "vcpu" in e.properties:
+ vcpu_id = 0
+ else:
+ vcpu_id = "TRACE_VCPU_EVENT_NONE"
+ out('TraceEvent %(event)s = {',
+ ' .id = 0,',
+ ' .vcpu_id = %(vcpu_id)s,',
+ ' .name = \"%(name)s\",',
+ ' .sstate = %(sstate)s,',
+ ' .dstate = &%(dstate)s ',
+ '};',
+ event = e.api(e.QEMU_EVENT),
+ vcpu_id = vcpu_id,
+ name = e.name,
+ sstate = "TRACE_%s_ENABLED" % e.name.upper(),
+ dstate = e.api(e.QEMU_DSTATE))
+
+ out('TraceEvent *%(group)s_trace_events[] = {',
+ group = group.lower())
+
+ for e in events:
+ out(' &%(event)s,', event = e.api(e.QEMU_EVENT))
+
+ out(' NULL,',
+ '};',
+ '')
+
+ out('static void trace_%(group)s_register_events(void)',
+ '{',
+ ' trace_event_register_group(%(group)s_trace_events);',
+ '}',
+ 'trace_init(trace_%(group)s_register_events)',
+ group = group.lower())
+
+ backend.generate_begin(active_events, group)
+ for event in active_events:
+ backend.generate(event, group)
+ backend.generate_end(active_events, group)
diff --git a/scripts/tracetool/format/d.py b/scripts/tracetool/format/d.py
index c77d5b7ab0..78397c24d2 100644
--- a/scripts/tracetool/format/d.py
+++ b/scripts/tracetool/format/d.py
@@ -29,7 +29,7 @@ RESERVED_WORDS = (
)
-def generate(events, backend):
+def generate(events, backend, group):
events = [e for e in events
if "disable" not in e.properties]
diff --git a/scripts/tracetool/format/events_c.py b/scripts/tracetool/format/events_c.py
deleted file mode 100644
index 4012063283..0000000000
--- a/scripts/tracetool/format/events_c.py
+++ /dev/null
@@ -1,44 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-"""
-trace/generated-events.c
-"""
-
-__author__ = "Lluís Vilanova <vilanova@ac.upc.edu>"
-__copyright__ = "Copyright 2012-2016, 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"
-
-
-from tracetool import out
-
-
-def generate(events, backend):
- out('/* This file is autogenerated by tracetool, do not edit. */',
- '',
- '#include "qemu/osdep.h"',
- '#include "trace.h"',
- '#include "trace/generated-events.h"',
- '#include "trace/control.h"',
- '')
-
- out('TraceEvent trace_events[TRACE_EVENT_COUNT] = {')
-
- for e in events:
- if "vcpu" in e.properties:
- vcpu_id = "TRACE_VCPU_" + e.name.upper()
- else:
- vcpu_id = "TRACE_VCPU_EVENT_COUNT"
- out(' { .id = %(id)s, .vcpu_id = %(vcpu_id)s,'
- ' .name = \"%(name)s\",'
- ' .sstate = %(sstate)s },',
- id = "TRACE_" + e.name.upper(),
- vcpu_id = vcpu_id,
- name = e.name,
- sstate = "TRACE_%s_ENABLED" % e.name.upper())
-
- out('};',
- '')
diff --git a/scripts/tracetool/format/events_h.py b/scripts/tracetool/format/events_h.py
deleted file mode 100644
index a9da60b7fa..0000000000
--- a/scripts/tracetool/format/events_h.py
+++ /dev/null
@@ -1,60 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-"""
-trace/generated-events.h
-"""
-
-__author__ = "Lluís Vilanova <vilanova@ac.upc.edu>"
-__copyright__ = "Copyright 2012-2016, 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"
-
-
-from tracetool import out
-
-
-def generate(events, backend):
- out('/* This file is autogenerated by tracetool, do not edit. */',
- '',
- '#ifndef TRACE__GENERATED_EVENTS_H',
- '#define TRACE__GENERATED_EVENTS_H',
- '')
-
- # event identifiers
- out('typedef enum {')
-
- for e in events:
- out(' TRACE_%s,' % e.name.upper())
-
- out(' TRACE_EVENT_COUNT',
- '} TraceEventID;')
-
- # per-vCPU event identifiers
- out('typedef enum {')
-
- for e in events:
- if "vcpu" in e.properties:
- out(' TRACE_VCPU_%s,' % e.name.upper())
-
- out(' TRACE_VCPU_EVENT_COUNT',
- '} TraceEventVCPUID;')
-
- # static state
- for e in events:
- if 'disable' in e.properties:
- enabled = 0
- else:
- enabled = 1
- if "tcg-exec" in e.properties:
- # a single define for the two "sub-events"
- out('#define TRACE_%(name)s_ENABLED %(enabled)d',
- name=e.original.name.upper(),
- enabled=enabled)
- out('#define TRACE_%s_ENABLED %d' % (e.name.upper(), enabled))
-
- out('#include "trace/event-internal.h"',
- '',
- '#endif /* TRACE__GENERATED_EVENTS_H */')
diff --git a/scripts/tracetool/format/h.py b/scripts/tracetool/format/h.py
index 3763e9aecb..3682f4e6a8 100644
--- a/scripts/tracetool/format/h.py
+++ b/scripts/tracetool/format/h.py
@@ -16,24 +16,43 @@ __email__ = "stefanha@linux.vnet.ibm.com"
from tracetool import out
-def generate(events, backend):
+def generate(events, backend, group):
out('/* This file is autogenerated by tracetool, do not edit. */',
'',
- '#ifndef TRACE__GENERATED_TRACERS_H',
- '#define TRACE__GENERATED_TRACERS_H',
+ '#ifndef TRACE_%s_GENERATED_TRACERS_H' % group.upper(),
+ '#define TRACE_%s_GENERATED_TRACERS_H' % group.upper(),
'',
'#include "qemu-common.h"',
'#include "trace/control.h"',
'')
- backend.generate_begin(events)
+ for e in events:
+ out('extern TraceEvent %(event)s;',
+ event = e.api(e.QEMU_EVENT))
+
+ for e in events:
+ out('extern uint16_t %s;' % e.api(e.QEMU_DSTATE))
+
+ # static state
+ for e in events:
+ if 'disable' in e.properties:
+ enabled = 0
+ else:
+ enabled = 1
+ if "tcg-exec" in e.properties:
+ # a single define for the two "sub-events"
+ out('#define TRACE_%(name)s_ENABLED %(enabled)d',
+ name=e.original.name.upper(),
+ enabled=enabled)
+ out('#define TRACE_%s_ENABLED %d' % (e.name.upper(), enabled))
+
+ backend.generate_begin(events, group)
for e in events:
if "vcpu" in e.properties:
trace_cpu = next(iter(e.args))[1]
cond = "trace_event_get_vcpu_state(%(cpu)s,"\
- " TRACE_%(id)s,"\
- " TRACE_VCPU_%(id)s)"\
+ " TRACE_%(id)s)"\
% dict(
cpu=trace_cpu,
id=e.name.upper())
@@ -49,11 +68,11 @@ def generate(events, backend):
cond=cond)
if "disable" not in e.properties:
- backend.generate(e)
+ backend.generate(e, group)
out(' }',
'}')
- backend.generate_end(events)
+ backend.generate_end(events, group)
- out('#endif /* TRACE__GENERATED_TRACERS_H */')
+ out('#endif /* TRACE_%s_GENERATED_TRACERS_H */' % group.upper())
diff --git a/scripts/tracetool/format/simpletrace_stap.py b/scripts/tracetool/format/simpletrace_stap.py
index 7e44bc1811..c35e662e00 100644
--- a/scripts/tracetool/format/simpletrace_stap.py
+++ b/scripts/tracetool/format/simpletrace_stap.py
@@ -19,8 +19,27 @@ from tracetool.backend.simple import is_string
from tracetool.format.stap import stap_escape
-def generate(events, backend):
+def generate(events, backend, group):
out('/* This file is autogenerated by tracetool, do not edit. */',
+ '',
+ 'global event_name_to_id_map',
+ 'global event_next_id',
+ 'function simple_trace_map_event(name)',
+ '',
+ '{',
+ ' if (!([name] in event_name_to_id_map)) {',
+ ' event_name_to_id_map[name] = event_next_id',
+ ' name_len = strlen(name)',
+ ' printf("%%8b%%8b%%4b%%.*s", 0, ',
+ ' event_next_id, name_len, name_len, name)',
+ ' event_next_id = event_next_id + 1',
+ ' }',
+ ' return event_name_to_id_map[name]',
+ '}',
+ 'probe begin',
+ '{',
+ ' printf("%%8b%%8b%%8b", 0xffffffffffffffff, 0xf2b177cb0aa429b4, 4)',
+ '}',
'')
for event_id, e in enumerate(events):
@@ -29,6 +48,7 @@ def generate(events, backend):
out('probe %(probeprefix)s.simpletrace.%(name)s = %(probeprefix)s.%(name)s ?',
'{',
+ ' id = simple_trace_map_event("%(name)s")',
probeprefix=probeprefix(),
name=e.name)
@@ -48,7 +68,7 @@ def generate(events, backend):
sizestr = ' + '.join(sizes)
# Generate format string and value pairs for record header and arguments
- fields = [('8b', str(event_id)),
+ fields = [('8b', 'id'),
('8b', 'gettimeofday_ns()'),
('4b', sizestr),
('4b', 'pid()')]
@@ -63,7 +83,7 @@ def generate(events, backend):
# Emit the entire record in a single SystemTap printf()
fmt_str = '%'.join(fmt for fmt, _ in fields)
arg_str = ', '.join(arg for _, arg in fields)
- out(' printf("%%%(fmt_str)s", %(arg_str)s)',
+ out(' printf("%%8b%%%(fmt_str)s", 1, %(arg_str)s)',
fmt_str=fmt_str, arg_str=arg_str)
out('}')
diff --git a/scripts/tracetool/format/stap.py b/scripts/tracetool/format/stap.py
index 9e780f1b06..e8ef3e762d 100644
--- a/scripts/tracetool/format/stap.py
+++ b/scripts/tracetool/format/stap.py
@@ -34,7 +34,7 @@ def stap_escape(identifier):
return identifier
-def generate(events, backend):
+def generate(events, backend, group):
events = [e for e in events
if "disable" not in e.properties]
diff --git a/scripts/tracetool/format/tcg_h.py b/scripts/tracetool/format/tcg_h.py
index e2331f251d..5f213f6cba 100644
--- a/scripts/tracetool/format/tcg_h.py
+++ b/scripts/tracetool/format/tcg_h.py
@@ -27,12 +27,12 @@ def vcpu_transform_args(args):
])
-def generate(events, backend):
+def generate(events, backend, group):
out('/* This file is autogenerated by tracetool, do not edit. */',
'/* You must include this file after the inclusion of helper.h */',
'',
- '#ifndef TRACE__GENERATED_TCG_TRACERS_H',
- '#define TRACE__GENERATED_TCG_TRACERS_H',
+ '#ifndef TRACE_%s_GENERATED_TCG_TRACERS_H' % group.upper(),
+ '#define TRACE_%s_GENERATED_TCG_TRACERS_H' % group.upper(),
'',
'#include "trace.h"',
'#include "exec/helper-proto.h"',
@@ -63,4 +63,4 @@ def generate(events, backend):
out('}')
out('',
- '#endif /* TRACE__GENERATED_TCG_TRACERS_H */')
+ '#endif /* TRACE_%s_GENERATED_TCG_TRACERS_H */' % group.upper())
diff --git a/scripts/tracetool/format/tcg_helper_c.py b/scripts/tracetool/format/tcg_helper_c.py
index e3485b7f92..cc26e03008 100644
--- a/scripts/tracetool/format/tcg_helper_c.py
+++ b/scripts/tracetool/format/tcg_helper_c.py
@@ -40,7 +40,7 @@ def vcpu_transform_args(args, mode):
assert False
-def generate(events, backend):
+def generate(events, backend, group):
events = [e for e in events
if "disable" not in e.properties]
diff --git a/scripts/tracetool/format/tcg_helper_h.py b/scripts/tracetool/format/tcg_helper_h.py
index dc76c15ebc..6b184b641b 100644
--- a/scripts/tracetool/format/tcg_helper_h.py
+++ b/scripts/tracetool/format/tcg_helper_h.py
@@ -18,7 +18,7 @@ from tracetool.transform import *
import tracetool.vcpu
-def generate(events, backend):
+def generate(events, backend, group):
events = [e for e in events
if "disable" not in e.properties]
diff --git a/scripts/tracetool/format/tcg_helper_wrapper_h.py b/scripts/tracetool/format/tcg_helper_wrapper_h.py
index 020f4422a9..ff53447512 100644
--- a/scripts/tracetool/format/tcg_helper_wrapper_h.py
+++ b/scripts/tracetool/format/tcg_helper_wrapper_h.py
@@ -18,7 +18,7 @@ from tracetool.transform import *
import tracetool.vcpu
-def generate(events, backend):
+def generate(events, backend, group):
events = [e for e in events
if "disable" not in e.properties]
diff --git a/scripts/tracetool/format/ust_events_c.py b/scripts/tracetool/format/ust_events_c.py
index 9967c7a82e..cd87d8ab8f 100644
--- a/scripts/tracetool/format/ust_events_c.py
+++ b/scripts/tracetool/format/ust_events_c.py
@@ -16,7 +16,7 @@ __email__ = "stefanha@redhat.com"
from tracetool import out
-def generate(events, backend):
+def generate(events, backend, group):
events = [e for e in events
if "disabled" not in e.properties]
diff --git a/scripts/tracetool/format/ust_events_h.py b/scripts/tracetool/format/ust_events_h.py
index 3e8a7cdf19..d853155d21 100644
--- a/scripts/tracetool/format/ust_events_h.py
+++ b/scripts/tracetool/format/ust_events_h.py
@@ -16,7 +16,7 @@ __email__ = "stefanha@redhat.com"
from tracetool import out
-def generate(events, backend):
+def generate(events, backend, group):
events = [e for e in events
if "disabled" not in e.properties]
@@ -28,8 +28,9 @@ def generate(events, backend):
'#undef TRACEPOINT_INCLUDE_FILE',
'#define TRACEPOINT_INCLUDE_FILE ./generated-ust-provider.h',
'',
- '#if !defined (TRACE__GENERATED_UST_H) || defined(TRACEPOINT_HEADER_MULTI_READ)',
- '#define TRACE__GENERATED_UST_H',
+ '#if !defined (TRACE_%s_GENERATED_UST_H) || \\' % group.upper(),
+ ' defined(TRACEPOINT_HEADER_MULTI_READ)',
+ '#define TRACE_%s_GENERATED_UST_H' % group.upper(),
'',
'#include "qemu-common.h"',
'#include <lttng/tracepoint.h>',
@@ -94,7 +95,7 @@ def generate(events, backend):
'',
name=e.name)
- out('#endif /* TRACE__GENERATED_UST_H */',
+ out('#endif /* TRACE_%s_GENERATED_UST_H */' % group.upper(),
'',
'/* This part must be outside ifdef protection */',
'#include <lttng/tracepoint-event.h>')