]>
git.proxmox.com Git - mirror_qemu.git/blob - scripts/tracetool/format/h.py
2 # -*- coding: utf-8 -*-
5 trace/generated-tracers.h
8 __author__
= "Lluís Vilanova <vilanova@ac.upc.edu>"
9 __copyright__
= "Copyright 2012-2016, Lluís Vilanova <vilanova@ac.upc.edu>"
10 __license__
= "GPL version 2 or (at your option) any later version"
12 __maintainer__
= "Stefan Hajnoczi"
13 __email__
= "stefanha@linux.vnet.ibm.com"
16 from tracetool
import out
19 def generate(events
, backend
):
20 out('/* This file is autogenerated by tracetool, do not edit. */',
22 '#ifndef TRACE__GENERATED_TRACERS_H',
23 '#define TRACE__GENERATED_TRACERS_H',
25 '#include "qemu-common.h"',
26 '#include "trace/control.h"',
30 out('extern TraceEvent %(event)s;',
31 event
= e
.api(e
.QEMU_EVENT
))
34 out('extern uint16_t %s;' % e
.api(e
.QEMU_DSTATE
))
38 if 'disable' in e
.properties
:
42 if "tcg-exec" in e
.properties
:
43 # a single define for the two "sub-events"
44 out('#define TRACE_%(name)s_ENABLED %(enabled)d',
45 name
=e
.original
.name
.upper(),
47 out('#define TRACE_%s_ENABLED %d' % (e
.name
.upper(), enabled
))
49 backend
.generate_begin(events
)
52 if "vcpu" in e
.properties
:
53 trace_cpu
= next(iter(e
.args
))[1]
54 cond
= "trace_event_get_vcpu_state(%(cpu)s,"\
63 'static inline void %(api)s(%(args)s)',
70 if "disable" not in e
.properties
:
76 backend
.generate_end(events
)
78 out('#endif /* TRACE__GENERATED_TRACERS_H */')