]>
Commit | Line | Data |
---|---|---|
fbc54b94 LV |
1 | #!/usr/bin/env python |
2 | # -*- coding: utf-8 -*- | |
3 | ||
4 | """ | |
5 | LTTng User Space Tracing backend. | |
6 | """ | |
7 | ||
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" | |
11 | ||
12 | __maintainer__ = "Stefan Hajnoczi" | |
13 | __email__ = "stefanha@linux.vnet.ibm.com" | |
14 | ||
15 | ||
16 | from tracetool import out | |
17 | ||
18 | ||
93fba161 LV |
19 | PUBLIC = True |
20 | ||
fbc54b94 | 21 | def c(events): |
9530570f MG |
22 | pass |
23 | ||
fbc54b94 | 24 | |
9530570f MG |
25 | def h(events): |
26 | out('#include <lttng/tracepoint.h>', | |
27 | '#include "trace/generated-ust-provider.h"', | |
28 | '') | |
fbc54b94 LV |
29 | for e in events: |
30 | argnames = ", ".join(e.args.names()) | |
31 | if len(e.args) > 0: | |
9530570f | 32 | argnames = ", " + argnames |
fbc54b94 | 33 | |
9530570f MG |
34 | out('static inline void trace_%(name)s(%(args)s)', |
35 | '{', | |
36 | ' tracepoint(qemu, %(name)s%(tp_args)s);', | |
37 | '}', | |
38 | '', | |
fbc54b94 | 39 | name = e.name, |
9530570f MG |
40 | args = e.args, |
41 | tp_args = argnames, | |
fbc54b94 LV |
42 | ) |
43 | ||
9530570f MG |
44 | def ust_events_c(events): |
45 | pass | |
fbc54b94 | 46 | |
9530570f | 47 | def ust_events_h(events): |
fbc54b94 LV |
48 | for e in events: |
49 | if len(e.args) > 0: | |
9530570f MG |
50 | out('TRACEPOINT_EVENT(', |
51 | ' qemu,', | |
52 | ' %(name)s,', | |
53 | ' TP_ARGS(%(args)s),', | |
54 | ' TP_FIELDS(', | |
fbc54b94 | 55 | name = e.name, |
9530570f | 56 | args = ", ".join(", ".join(i) for i in e.args), |
fbc54b94 LV |
57 | ) |
58 | ||
9530570f MG |
59 | for t,n in e.args: |
60 | if ('int' in t) or ('long' in t) or ('unsigned' in t) or ('size_t' in t): | |
61 | out(' ctf_integer(' + t + ', ' + n + ', ' + n + ')') | |
62 | elif ('double' in t) or ('float' in t): | |
63 | out(' ctf_float(' + t + ', ' + n + ', ' + n + ')') | |
64 | elif ('char *' in t) or ('char*' in t): | |
65 | out(' ctf_string(' + n + ', ' + n + ')') | |
66 | elif ('void *' in t) or ('void*' in t): | |
67 | out(' ctf_integer_hex(unsigned long, ' + n + ', ' + n + ')') | |
68 | ||
69 | out(' )', | |
70 | ')', | |
71 | '') | |
72 | ||
fbc54b94 | 73 | else: |
9530570f MG |
74 | out('TRACEPOINT_EVENT(', |
75 | ' qemu,', | |
76 | ' %(name)s,', | |
77 | ' TP_ARGS(void),', | |
78 | ' TP_FIELDS()', | |
79 | ')', | |
80 | '', | |
fbc54b94 | 81 | name = e.name, |
9530570f | 82 | ) |