Example 1. Create a single-port source component and a
single-port sink component and connect them.
$ babeltrace2 run --component=A:src.plug.my-src \
--component=B:sink.plug.my-sink \
--connect=A:B
Possible resulting graph:
+-----------------+ +-------------------+
| src.plug.my-src | | sink.plug.my-sink |
| [A] | | [B] |
| | | |
| out @--->@ in |
+-----------------+ +-------------------+
Example 2. Use the --params option to set the current component's
initialization parameters.
In this example, the --params
option only applies to component
the-source
.
$ babeltrace2 run --component=the-source:src.my-plugin.my-src \
--params=offset=123,flag=true \
--component=the-sink:sink.my-plugin.my-sink \
--connect=the-source:the-sink
Example 3. Use the --base-params and --reset-base-params options
to set and reset the current base initialization parameters.
In this example, the effective initialization parameters of the
created components are:
Component A
offset=1203, flag=false
Component B
offset=1203, flag=true, type=event
Component C
ratio=0.25
$ babeltrace2 run --base-params=offset=1203,flag=false \
--component=A:src.plugin.compcls \
--component=B:flt.plugin.compcls \
--params=flag=true,type=event \
--reset-base-params \
--component=C:sink.plugin.compcls \
--params=ratio=0.25 \
--connect=A:B --connect=B:C
Example 4. Specify a component connection fallback rule.
In this example, any A
output port of which the name starts with
foo
is connected to a B
input port of which the name starts with
nin
. Any other A
output port is connected to a B
input port of
which the name starts with oth
.
The order of the --connect
options is important here: the
opposite order would create a system in which the first rule is
always satisfied, and any A
output port, whatever its name, would
be connected to a B
input port with a name that starts with oth
.
$ babeltrace2 run --component=A:src.plug.my-src \
--component=B:sink.plug.my-sink \
--connect='A.foo*:B:nin*' --connect='A:B.oth*'
Possible resulting graph:
+-----------------+ +-------------------+
| src.plug.my-src | | sink.plug.my-sink |
| [A] | | [B] |
| | | |
| foot @--->@ nine |
| foodies @--->@ ninja |
| some-port @--->@ othello |
| hello @--->@ other |
+-----------------+ +-------------------+