]> git.proxmox.com Git - mirror_qemu.git/blob - scripts/tracetool/format/events_c.py
Merge remote-tracking branch 'stefanha/trivial-patches' into staging
[mirror_qemu.git] / scripts / tracetool / format / events_c.py
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3
4 """
5 Generate .c for event description.
6 """
7
8 __author__ = "Lluís Vilanova <vilanova@ac.upc.edu>"
9 __copyright__ = "Copyright 2012, Lluís Vilanova <vilanova@ac.upc.edu>"
10 __license__ = "GPL version 2 or (at your option) any later version"
11
12 __maintainer__ = "Stefan Hajnoczi"
13 __email__ = "stefanha@linux.vnet.ibm.com"
14
15
16 from tracetool import out
17
18
19 def begin(events):
20 out('/* This file is autogenerated by tracetool, do not edit. */',
21 '',
22 '#include "trace.h"',
23 '#include "trace/generated-events.h"',
24 '#include "trace/control.h"',
25 '',
26 )
27
28 out('TraceEvent trace_events[TRACE_EVENT_COUNT] = {')
29
30 for e in events:
31 out(' { .id = %(id)s, .name = \"%(name)s\", .sstate = %(sstate)s, .dstate = 0 },',
32 id = "TRACE_" + e.name.upper(),
33 name = e.name,
34 sstate = "TRACE_%s_ENABLED" % e.name.upper(),
35 )
36
37 out('};',
38 '',
39 )