xref: /qemu/scripts/tracetool/format/h.py (revision acb0ef58)
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3
4"""
5trace/generated-tracers.h
6"""
7
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"
11
12__maintainer__ = "Stefan Hajnoczi"
13__email__      = "stefanha@linux.vnet.ibm.com"
14
15
16from tracetool import out
17
18
19def generate(events, backend):
20    out('/* This file is autogenerated by tracetool, do not edit. */',
21        '',
22        '#ifndef TRACE__GENERATED_TRACERS_H',
23        '#define TRACE__GENERATED_TRACERS_H',
24        '',
25        '#include "qemu-common.h"',
26        '')
27
28    backend.generate_begin(events)
29
30    for e in events:
31        out('',
32            'static inline void %(api)s(%(args)s)',
33            '{',
34            api=e.api(),
35            args=e.args)
36
37        if "disable" not in e.properties:
38            backend.generate(e)
39
40        out('}')
41
42    backend.generate_end(events)
43
44    out('#endif /* TRACE__GENERATED_TRACERS_H */')
45