Modified the tracetool framework for LTTng 2.x
[qemu.git] / scripts / tracetool / format / ust_events_h.py
blobf206eca6ecff0afb19e6d487dc3807e47b1fe600
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
4 """
5 Generate .h for LTTng ust event description.
6 """
8 __author__ = "Mohamad Gebai <mohamad.gebai@polymtl.ca>"
9 __copyright__ = "Copyright 2012, Mohamad Gebai <mohamad.gebai@polymtl.ca>"
10 __license__ = "GPL version 2 or (at your option) any later version"
12 __maintainer__ = "Stefan Hajnoczi"
13 __email__ = "stefanha@redhat.com"
16 from tracetool import out
19 def begin(events):
20 out('/* This file is autogenerated by tracetool, do not edit. */',
21 '',
22 '#undef TRACEPOINT_PROVIDER',
23 '#define TRACEPOINT_PROVIDER qemu',
24 '',
25 '#undef TRACEPOINT_INCLUDE_FILE',
26 '#define TRACEPOINT_INCLUDE_FILE ./generated-ust-provider.h',
27 '',
28 '#if !defined (TRACE__GENERATED_UST_H) || defined(TRACEPOINT_HEADER_MULTI_READ)',
29 '#define TRACE__GENERATED_UST_H',
30 '',
31 '#include "qemu-common.h"',
32 '#include <lttng/tracepoint.h>',
33 '',
34 '/*',
35 ' * LTTng ust 2.0 does not allow you to use TP_ARGS(void) for tracepoints',
36 ' * requiring no arguments. We define these macros introduced in more recent'
37 ' * versions of LTTng ust as a workaround',
38 ' */',
39 '#ifndef _TP_EXPROTO1',
40 '#define _TP_EXPROTO1(a) void',
41 '#endif',
42 '#ifndef _TP_EXDATA_PROTO1',
43 '#define _TP_EXDATA_PROTO1(a) void *__tp_data',
44 '#endif',
45 '#ifndef _TP_EXDATA_VAR1',
46 '#define _TP_EXDATA_VAR1(a) __tp_data',
47 '#endif',
48 '#ifndef _TP_EXVAR1',
49 '#define _TP_EXVAR1(a)',
50 '#endif',
51 '')
53 def end(events):
54 out('#endif /* TRACE__GENERATED_UST_H */',
55 '',
56 '/* This part must be outside ifdef protection */',
57 '#include <lttng/tracepoint-event.h>')