2 # -*- coding: utf-8 -*-
5 DTrace/SystemTAP backend.
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"
12 __maintainer__ = "Stefan Hajnoczi"
13 __email__ = "stefanha@linux.vnet.ibm.com"
16 from tracetool import out
22 if PROBEPREFIX is None:
23 raise ValueError("you must set PROBEPREFIX")
31 raise ValueError("you must set BINARY")
40 out('#include "trace-dtrace.h"',
44 out('static inline void trace_%(name)s(%(args)s) {',
45 ' QEMU_%(uppername)s(%(argnames)s);',
49 uppername = e.name.upper(),
50 argnames = ", ".join(e.args.names()),
55 out('provider qemu {')
60 # DTrace provider syntax expects foo() for empty
61 # params, not foo(void)
65 # Define prototype for probe arguments
67 'probe %(name)s(%(args)s);',
78 # Define prototype for probe arguments
79 out('probe %(probeprefix)s.%(name)s = process("%(binary)s").mark("%(name)s")',
81 probeprefix = _probeprefix(),
88 for name in e.args.names():
89 # Append underscore to reserved keywords
90 if name in ('limit', 'in', 'next', 'self'):
92 out(' %s = $arg%d;' % (name, i))