]> Git Repo - qemu.git/blob - scripts/tracetool/format/events_h.py
trace: [tracetool] Change format docs to point to the generated file
[qemu.git] / scripts / tracetool / format / events_h.py
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3
4 """
5 trace/generated-events.h
6 """
7
8 __author__     = "Lluís Vilanova <[email protected]>"
9 __copyright__  = "Copyright 2012-2014, Lluís Vilanova <[email protected]>"
10 __license__    = "GPL version 2 or (at your option) any later version"
11
12 __maintainer__ = "Stefan Hajnoczi"
13 __email__      = "[email protected]"
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         '#ifndef TRACE__GENERATED_EVENTS_H',
23         '#define TRACE__GENERATED_EVENTS_H',
24         '',
25         '#include <stdbool.h>',
26         ''
27         )
28
29     # event identifiers
30     out('typedef enum {')
31
32     for e in events:
33         out('    TRACE_%s,' % e.name.upper())
34
35     out('    TRACE_EVENT_COUNT',
36         '} TraceEventID;',
37         )
38
39     # static state
40     for e in events:
41         if 'disable' in e.properties:
42             enabled = 0
43         else:
44             enabled = 1
45         out('#define TRACE_%s_ENABLED %d' % (e.name.upper(), enabled))
46
47     out('#include "trace/event-internal.h"',
48         '',
49         '#endif  /* TRACE__GENERATED_EVENTS_H */',
50         )
This page took 0.026408 seconds and 4 git commands to generate.