spapr_llan: fix device reenabling
[qemu/agraf.git] / scripts / tracetool / backend / ust.py
blobea36995092225b0399c8d60dab3d65a6a0a6b5fb
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
4 """
5 LTTng User Space Tracing backend.
6 """
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
19 PUBLIC = True
22 def c(events):
23 out('#include <ust/marker.h>',
24 '#undef mutex_lock',
25 '#undef mutex_unlock',
26 '#undef inline',
27 '#undef wmb',
28 '#include "trace.h"')
30 for e in events:
31 argnames = ", ".join(e.args.names())
32 if len(e.args) > 0:
33 argnames = ', ' + argnames
35 out('DEFINE_TRACE(ust_%(name)s);',
36 '',
37 'static void ust_%(name)s_probe(%(args)s)',
38 '{',
39 ' trace_mark(ust, %(name)s, %(fmt)s%(argnames)s);',
40 '}',
41 name = e.name,
42 args = e.args,
43 fmt = e.fmt,
44 argnames = argnames,
47 else:
48 out('DEFINE_TRACE(ust_%(name)s);',
49 '',
50 'static void ust_%(name)s_probe(%(args)s)',
51 '{',
52 ' trace_mark(ust, %(name)s, UST_MARKER_NOARGS);',
53 '}',
54 name = e.name,
55 args = e.args,
58 # register probes
59 out('',
60 'static void __attribute__((constructor)) trace_init(void)',
61 '{')
63 for e in events:
64 out(' register_trace_ust_%(name)s(ust_%(name)s_probe);',
65 name = e.name,
68 out('}')
71 def h(events):
72 out('#include <ust/tracepoint.h>',
73 '#undef mutex_lock',
74 '#undef mutex_unlock',
75 '#undef inline',
76 '#undef wmb')
78 for e in events:
79 if len(e.args) > 0:
80 out('DECLARE_TRACE(ust_%(name)s, TP_PROTO(%(args)s), TP_ARGS(%(argnames)s));',
81 '#define trace_%(name)s trace_ust_%(name)s',
82 name = e.name,
83 args = e.args,
84 argnames = ", ".join(e.args.names()),
87 else:
88 out('_DECLARE_TRACEPOINT_NOARGS(ust_%(name)s);',
89 '#define trace_%(name)s trace_ust_%(name)s',
90 name = e.name,
93 out()