hw/arm/virt-acpi-build: Add SPCR table
[qemu/ar7.git] / scripts / tracetool / format / events_h.py
blob9f114a3497760339b910e3785d29d9444bd9f248
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-2014, 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 <stdbool.h>',
26 '')
28 # event identifiers
29 out('typedef enum {')
31 for e in events:
32 out(' TRACE_%s,' % e.name.upper())
34 out(' TRACE_EVENT_COUNT',
35 '} TraceEventID;')
37 # static state
38 for e in events:
39 if 'disable' in e.properties:
40 enabled = 0
41 else:
42 enabled = 1
43 if "tcg-trans" in e.properties:
44 # a single define for the two "sub-events"
45 out('#define TRACE_%(name)s_ENABLED %(enabled)d',
46 name=e.original.original.name.upper(),
47 enabled=enabled)
48 out('#define TRACE_%s_ENABLED %d' % (e.name.upper(), enabled))
50 out('#include "trace/event-internal.h"',
51 '',
52 '#endif /* TRACE__GENERATED_EVENTS_H */')