1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3
4"""
5DTrace/SystemTAP backend.
6"""
7
8__author__     = "Lluís Vilanova <vilanova@ac.upc.edu>"
9__copyright__  = "Copyright 2012-2016, 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
19PUBLIC = True
20
21
22PROBEPREFIX = None
23
24def probeprefix():
25    if PROBEPREFIX is None:
26        raise ValueError("you must set PROBEPREFIX")
27    return PROBEPREFIX
28
29
30BINARY = None
31
32def binary():
33    if BINARY is None:
34        raise ValueError("you must set BINARY")
35    return BINARY
36
37
38def generate_h_begin(events, group):
39    if group == "root":
40        header = "trace-dtrace-root.h"
41    else:
42        header = "trace-dtrace.h"
43
44    out('#include "%s"' % header,
45        '')
46
47
48def generate_h(event, group):
49    out('        QEMU_%(uppername)s(%(argnames)s);',
50        uppername=event.name.upper(),
51        argnames=", ".join(event.args.names()))
52