]> git.proxmox.com Git - qemu.git/blame - scripts/tracetool/format/h.py
build: Use separate makefile for "trace/"
[qemu.git] / scripts / tracetool / format / h.py
CommitLineData
c419e62a
LV
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3
4"""
5Generate .h file.
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
16from tracetool import out
17
18
19def begin(events):
20 out('/* This file is autogenerated by tracetool, do not edit. */',
21 '',
eac236ea
LV
22 '#ifndef TRACE__GENERATED_TRACERS_H',
23 '#define TRACE__GENERATED_TRACERS_H',
c419e62a
LV
24 '',
25 '#include "qemu-common.h"')
26
27def end(events):
28 for e in events:
29 if "disable" in e.properties:
30 enabled = 0
31 else:
32 enabled = 1
33 out('#define TRACE_%s_ENABLED %d' % (e.name.upper(), enabled))
34 out('',
eac236ea 35 '#endif /* TRACE__GENERATED_TRACERS_H */')
c419e62a
LV
36
37def nop(events):
38 for e in events:
39 out('',
40 'static inline void trace_%(name)s(%(args)s)',
41 '{',
42 '}',
43 name = e.name,
44 args = e.args,
45 )