ff1c06aec997bef78709b2264ca7a08fc3bfa07b
[lttng-docs.git] / contents / using-lttng / instrumenting / c-application / lttng-gen-tp.md
1 ---
2 id: lttng-gen-tp
3 ---
4
5 LTTng-UST ships with `lttng-gen-tp`, a handy command line utility for
6 generating most of the stuff discussed above. It takes a _template file_,
7 with a name usually ending with the `.tp` extension, containing only
8 tracepoint definitions, and outputs a tracepoint provider (either a C
9 source file or a precompiled object file) with its header file.
10
11 `lttng-gen-tp` should suffice in [static linking](#doc-static-linking)
12 situations. When using it, write a template file containing a list of
13 `TRACEPOINT_EVENT()` macro calls. The tool finds the provider names
14 used and generate the appropriate files which are going to look a lot
15 like `tp.h` and `tp.c` above.
16
17 Just call `lttng-gen-tp` like this:
18
19 <pre class="term">
20 lttng-gen-tp my-template.tp
21 </pre>
22
23 `my-template.c`, `my-template.o` and `my-template.h` are created
24 in the same directory.
25
26 You may specify custom C flags passed to the compiler invoked by
27 `lttng-gen-tp` using the `CFLAGS` environment variable:
28
29 <pre class="term">
30 CFLAGS=-I/custom/include/path lttng-gen-tp my-template.tp
31 </pre>
32
33 For more information on `lttng-gen-tp`, see
34 <a href="/man/1/lttng-gen-tp" class="ext">its manpage</a>.
This page took 0.031089 seconds and 3 git commands to generate.