LTTNG-GEN-TP(1)

✨ lttng-gen-tp ✨

okay bestie, so this is a page from the LTTng Manual, and the command is lttng-gen-tp β€” she's the one who writes your tracepoint provider code for you so you don't have to πŸ’…


🌸 NAME 🌸

lttng-gen-tp β€” Generate LTTng-UST tracepoint provider code


πŸŽ€ SYNOPSIS πŸŽ€

lttng-gen-tp [--verbose] [--output=FILE.c]
             [--output=FILE.h] [--output=FILE.o] TEMPLATE

πŸ’– DESCRIPTION πŸ’–

The lttng-gen-tp tool is literally here to simplify the generation of LTTng-UST tracepoint provider files. You hand it a simple template file, TEMPLATE, and it spits out all the C code you need to actually use the tracepoints you defined in your app. Wanna know what TEMPLATE is supposed to look like? Scroll down to the Template file format section, iykyk.

Currently, lttng-gen-tp can generate the .h, .c, and .o files that go with your tracepoint provider. The generated .h file can be included directly in your application β€” no extra steps, just slay. You can let lttng-gen-tp generate the .o file for you, or you can compile the .c file yourself, your call, main character energy either way. Wanna know more about compiling LTTng-UST tracepoint providers? See lttng-ust(3).

By default, lttng-gen-tp generates the .h, .c, and .o files, and their basename is the basename of TEMPLATE. But if you only want some of them, you can generate one or more specific file types with the --output option β€” just repeat it as many times as you need 🫢

πŸ¦‹ Template file format πŸ¦‹

The template file β€” which usually has the .tp extension, cute β€” contains a list of LTTNG_UST_TRACEPOINT_EVENT() definitions plus other optional definition entries, like LTTNG_UST_TRACEPOINT_LOGLEVEL(). For the complete list of available definitions, see lttng-ust(3).

The LTTNG_UST_TRACEPOINT_EVENT() definitions are written exactly as you would write them in an LTTng-UST template provider header file. C comments are supported (/* */ and //), and so are lines starting with #.

Note The provider name (the first argument of LTTNG_UST_TRACEPOINT_EVENT()) must be the same in all the LTTNG_UST_TRACEPOINT_EVENT() macros of TEMPLATE. No switching up mid-file, bestie, she will notice 😭

Here's an example:

LTTNG_UST_TRACEPOINT_EVENT(
    // Tracepoint provider name
    my_provider,

    // Tracepoint/event name
    my_event,

    // Tracepoint arguments (input)
    LTTNG_UST_TP_ARGS(char *, text),

    // Tracepoint/event fields (output)
    LTTNG_UST_TP_FIELDS(
        lttng_ust_field_string(message, text)
    )
)

✨ OPTIONS ✨

  • -o, --output=FILE β€” Do not generate the default files: generate FILE instead.

The extension of FILE is what decides what gets generated, out of .h, .c, and .o. You can use this option more than one time to generate different file types. Go off πŸ’…

  • -v, --verbose β€” Increase verbosity. She'll tell you more about what she's doing.
  • -h, --help β€” Show command help.

🌈 ENVIRONMENT VARIABLES 🌈

  • CC β€” C compiler to use. Default: cc, then gcc if cc is not found. This option is only relevant when generating the .o file.
  • CFLAGS β€” Flags and options passed directly to the compiler ($CC). This option is only relevant when generating the .o file.

πŸ’œ EXIT STATUS πŸ’œ

  • 0 β€” Success πŸŽ‰
  • Non-zero β€” Error 😭

πŸ’€ BUGS πŸ’€

If you encounter any issue or usability problem, please report it on the LTTng bug tracker https://bugs.lttng.org/projects/lttng-ust. Do it fr fr, they wanna know πŸ™ˆ


πŸ“ RESOURCES πŸ“


πŸ‘‘ COPYRIGHTS πŸ‘‘

lttng-gen-tp is part of the LTTng-UST project.

lttng-gen-tp is distributed under the GNU General Public License, version 2 http://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html. See the COPYING file https://github.com/lttng/lttng-ust/blob/v2.14/COPYING for more details.


🧚 AUTHOR 🧚

lttng-gen-tp was originally written by Yannick Brosseau yannick.brosseau@gmail.com. It is currently maintained by Mathieu Desnoyers mathieu.desnoyers@efficios.com. Iconic lineage honestly 🌟


πŸ’– SEE ALSO πŸ’–

lttng-ust(3)


and that's the whole page bestie!! this one's from LTTng 2.14.0, dated 06/27/2025 β€” no cap, go generate some tracepoint providers πŸ’…βœ¨πŸ¦‹

πŸ“¦ where this page comes from