]> git.proxmox.com Git - mirror_qemu.git/blame - scripts/tracetool/backend/dtrace.py
scripts/tracetool: Update maintainer email address
[mirror_qemu.git] / scripts / tracetool / backend / dtrace.py
CommitLineData
52ef093a
LV
1# -*- coding: utf-8 -*-
2
3"""
4DTrace/SystemTAP backend.
5"""
6
7__author__ = "Lluís Vilanova <vilanova@ac.upc.edu>"
1ff7b531 8__copyright__ = "Copyright 2012-2017, Lluís Vilanova <vilanova@ac.upc.edu>"
52ef093a
LV
9__license__ = "GPL version 2 or (at your option) any later version"
10
11__maintainer__ = "Stefan Hajnoczi"
f892b494 12__email__ = "stefanha@redhat.com"
52ef093a
LV
13
14
15from tracetool import out
16
17
93fba161
LV
18PUBLIC = True
19
20
52ef093a
LV
21PROBEPREFIX = None
22
1dad2ce9 23def probeprefix():
52ef093a
LV
24 if PROBEPREFIX is None:
25 raise ValueError("you must set PROBEPREFIX")
26 return PROBEPREFIX
27
28
29BINARY = None
30
1dad2ce9 31def binary():
52ef093a
LV
32 if BINARY is None:
33 raise ValueError("you must set BINARY")
34 return BINARY
35
36
80dd5c49 37def generate_h_begin(events, group):
0ab8ed18
DB
38 if group == "root":
39 header = "trace-dtrace-root.h"
40 else:
41 header = "trace-dtrace.h"
42
43 out('#include "%s"' % header,
52ef093a
LV
44 '')
45
3932ef3f
SH
46 # SystemTap defines <provider>_<name>_ENABLED() but other DTrace
47 # implementations might not.
48 for e in events:
49 out('#ifndef QEMU_%(uppername)s_ENABLED',
50 '#define QEMU_%(uppername)s_ENABLED() true',
51 '#endif',
52 uppername=e.name.upper())
1dad2ce9 53
80dd5c49 54def generate_h(event, group):
1ff7b531 55 out(' QEMU_%(uppername)s(%(argnames)s);',
1dad2ce9
LV
56 uppername=event.name.upper(),
57 argnames=", ".join(event.args.names()))
3932ef3f
SH
58
59
60def generate_h_backend_dstate(event, group):
61 out(' QEMU_%(uppername)s_ENABLED() || \\',
62 uppername=event.name.upper())