trace: remove the TraceEventID and TraceEventVCPUID enums
[qemu.git] / scripts / tracetool / format / events_h.py
blobca6d73051972653d48ccf8f03a4f8a0280ae70af
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
4 """
5 trace/generated-events.h
6 """
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. */',
21 '',
22 '#ifndef TRACE__GENERATED_EVENTS_H',
23 '#define TRACE__GENERATED_EVENTS_H',
24 '',
25 '#include "trace/event-internal.h"',
28 for e in events:
29 out('extern TraceEvent %(event)s;',
30 event = e.api(e.QEMU_EVENT))
32 for e in events:
33 out('extern uint16_t %s;' % e.api(e.QEMU_DSTATE))
35 numvcpu = len([e for e in events if "vcpu" in e.properties])
37 out("#define TRACE_VCPU_EVENT_COUNT %d" % numvcpu)
39 # static state
40 for e in events:
41 if 'disable' in e.properties:
42 enabled = 0
43 else:
44 enabled = 1
45 if "tcg-exec" in e.properties:
46 # a single define for the two "sub-events"
47 out('#define TRACE_%(name)s_ENABLED %(enabled)d',
48 name=e.original.name.upper(),
49 enabled=enabled)
50 out('#define TRACE_%s_ENABLED %d' % (e.name.upper(), enabled))
52 out('',
53 '#endif /* TRACE__GENERATED_EVENTS_H */')