2 # -*- coding: utf-8 -*-
5 Generate .stp file (DTrace with SystemTAP only).
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"
12 __maintainer__
= "Stefan Hajnoczi"
13 __email__
= "stefanha@linux.vnet.ibm.com"
16 from tracetool
import out
17 from tracetool
.backend
.dtrace
import binary
, probeprefix
20 # Technically 'self' is not used by systemtap yet, but
21 # they recommended we keep it in the reserved list anyway
23 'break', 'catch', 'continue', 'delete', 'else', 'for',
24 'foreach', 'function', 'global', 'if', 'in', 'limit',
25 'long', 'next', 'probe', 'return', 'self', 'string',
30 def stap_escape(identifier
):
31 # Append underscore to reserved keywords
32 if identifier
in RESERVED_WORDS
:
33 return identifier
+ '_'
37 def generate(events
, backend
, group
):
38 events
= [e
for e
in events
39 if "disable" not in e
.properties
]
41 out('/* This file is autogenerated by tracetool, do not edit. */',
45 # Define prototype for probe arguments
46 out('probe %(probeprefix)s.%(name)s = process("%(binary)s").mark("%(name)s")',
48 probeprefix
=probeprefix(),
54 for name
in e
.args
.names():
55 name
= stap_escape(name
)
56 out(' %s = $arg%d;' % (name
, i
))