1 // SPDX-FileCopyrightText: 2016 Philippe Proulx <pproulx@efficios.com>
2 // SPDX-License-Identifier: CC-BY-4.0
11 lttng-gen-tp - Generate LTTng-UST tracepoint provider code
17 *lttng-gen-tp* [option:--verbose] [option:--output='FILE'.c]
18 [option:--output='FILE'.h] [option:--output='FILE'.o] 'TEMPLATE'
23 The `lttng-gen-tp` tool simplifies the generation of LTTng-UST
24 tracepoint provider files. It takes a simple template file, 'TEMPLATE',
25 and generates the necessary C code to use the defined tracepoints in
26 your application. See the <<template-file-format,Template file format>>
27 section below for more information about the format of 'TEMPLATE'.
29 Currently, `lttng-gen-tp` can generate the `.h`, `.c`, and `.o` files
30 associated with your tracepoint provider. The generated `.h` file can be
31 included directly in your application. You can let `lttng-gen-tp`
32 generate the `.o` file or compile the `.c` file yourself. See
33 man:lttng-ust(3) for more information about compiling LTTng-UST
36 By default, `lttng-gen-tp` generates the `.h`, `.c`, and `.o` files,
37 their basename being the basename of 'TEMPLATE'. You can generate one or
38 more specific file types with the option:--output option, repeated if
42 [[template-file-format]]
45 The template file, which usually has the `.tp` extension, contains a
46 list of `LTTNG_UST_TRACEPOINT_EVENT()` definitions and other optional
47 definition entries, like `LTTNG_UST_TRACEPOINT_LOGLEVEL()`. See
48 man:lttng-ust(3) for the complete list of available definitions.
50 The `LTTNG_UST_TRACEPOINT_EVENT()` definitions are written as you would
51 write them in an LTTng-UST template provider header file. C comments are
52 supported (`/* */` and `//`), as well as lines starting with `#`.
54 NOTE: The provider name (the first argument of
55 `LTTNG_UST_TRACEPOINT_EVENT()`) must be the same in all the
56 `LTTNG_UST_TRACEPOINT_EVENT()` macros of 'TEMPLATE'.
60 ---------------------------------------
61 LTTNG_UST_TRACEPOINT_EVENT(
62 // Tracepoint provider name
65 // Tracepoint/event name
68 // Tracepoint arguments (input)
69 LTTNG_UST_TP_ARGS(char *, text),
71 // Tracepoint/event fields (output)
73 lttng_ust_field_string(message, text)
76 ---------------------------------------
81 option:-o, option:--output='FILE'::
82 Do not generate default files: generate 'FILE'.
84 The extension of 'FILE' determines what is generated, amongst `.h`,
85 `.c`, and `.o`. This option can be used more than one time to generate
88 option:-v, option:--verbose::
91 option:-h, option:--help::
98 C compiler to use. Default: `cc`, then `gcc` if `cc` is not found.
99 This option is only relevant when generating the `.o` file.
102 Flags and options passed directly to the compiler (`$CC`).
103 This option is only relevant when generating the `.o` file.
115 include::common-footer.txt[]
120 `lttng-gen-tp` is part of the LTTng-UST project.
122 `lttng-gen-tp` is distributed under the
123 http://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html[GNU General
124 Public License, version 2]. See the
125 https://github.com/lttng/lttng-ust/blob/v{lttng_version}/COPYING[`COPYING`] file
131 `lttng-gen-tp` was originally written by
132 mailto:yannick.brosseau@gmail.com[Yannick Brosseau]. It is currently
133 maintained by mailto:mathieu.desnoyers@efficios.com[Mathieu Desnoyers].