Generate files from a YAML configuration file
barectf ships with the
barectf command-line interface (CLI) tool.
barectf CLI tool has a command interface, like
This page focuses on the
barectf generate command. See
barectf CLI tool usage for the complete CLI tool’s documentation.
Generate files from a YAML configuration
barectf generate command to
generate files from a barectf YAML configuration
$ barectf generate my-config.yaml
On success, this command writes the following files to the current working directory:
The CTF metadata stream file.
You’ll need to place this file in a directory with the data stream files which your application will write through the generated tracer.
See How barectf works to learn more.
The generated tracer’s public C header file.
This header contains the prototypes of the packet opening, packet closing, and tracing functions.
barectf generates one packet opening/closing function per configured data stream type and one tracing function per configured event record type.
Your application and platforms need to include this file.
Internal macros for the generated tracer (included by
The generated tracer’s C source code.
Those file names assume that
my-config.yaml uses the default
Use dedicated output directories
metadata file which barectf generates is
part of an eventual
CTF trace, you’ll probably
want to make barectf write it to its own directory.
barectf generate command’s
to specify the
metadata file’s output directory:
$ barectf generate my-config.yaml --metadata-dir=my-trace
barectf generate also offers the
to select the output directories of the generated
tracer source file and headers.
A barectf YAML configuration file can include partial YAML files.
Set the most significant inclusion search directories with the
You can use the option more than once:
$ barectf generate my-config.yaml \ --include-dir=/path/to/project/barectf \ --include-dir=/path/to/base/barectf
By default, if
barectf generate can’t find an inclusion file, it
prints an error and exits with a non-zero
However, it’s possible that some YAML file A includes a file B which barectf can’t find, but A doesn’t need anything from B.
barectf generate to continue silently instead with its
$ barectf generate my-config.yaml --ignore-include-not-found \ --include-dir=/path/to/project/barectf \ --include-dir=/path/to/base/barectf \