| 1 | --- |
| 2 | id: c-application |
| 3 | --- |
| 4 | |
| 5 | Instrumenting a C (or C++) application, be it an executable program or |
| 6 | a library, implies using LTTng-UST, the |
| 7 | user space tracing component of LTTng. For C/C++ applications, the |
| 8 | LTTng-UST package includes a dynamically loaded library |
| 9 | (`liblttng-ust`), C headers and the `lttng-gen-tp` command line utility. |
| 10 | |
| 11 | Since C and C++ are the base languages of virtually all other |
| 12 | programming languages |
| 13 | (Java virtual machine, Python, Perl, PHP and Node.js interpreters, etc.), |
| 14 | implementing user space tracing for an unsupported language is just a |
| 15 | matter of using the LTTng-UST C API at the right places. |
| 16 | |
| 17 | The usual work flow to instrument a user space C application with |
| 18 | LTTng-UST is: |
| 19 | |
| 20 | 1. Define tracepoints (actual probes) |
| 21 | 2. Write tracepoint providers |
| 22 | 3. Insert tracepoints into target source code |
| 23 | 4. Package (build) tracepoint providers |
| 24 | 5. Build user application and link it with tracepoint providers |
| 25 | |
| 26 | The steps above are discussed in greater detail in the following |
| 27 | subsections. |