CLI: use -x as short option for --connection instead of -C
[babeltrace.git] / doc / man / babeltrace-run.1.txt
CommitLineData
838dd456
PP
1babeltrace-run(1)
2=================
3:manpagetype: command
4:revdate: 5 October 2017
5
6
7NAME
8----
9babeltrace-run - Create a trace processing graph and run it
10
11
12SYNOPSIS
13--------
14[verse]
15*babeltrace run* ['GENERAL OPTIONS'] [opt:--omit-home-plugin-path]
16 [opt:--omit-system-plugin-path]
17 [opt:--plugin-path='PATH'[:__PATH__]...]
18 [opt:--retry-duration='DURUS']
19 opt:--connect='CONN-RULE'... 'COMPONENTS'
20
21
22DESCRIPTION
23-----------
24The `run` command creates a trace processing graph and runs it.
25
26See man:babeltrace-intro(7) to learn more about the Babeltrace
27project and its core concepts.
28
29The `run` command uses libbabeltrace to dynamically load plugins which
30supply component classes. With the `run` command, you specify which
31component classes to instantiate as components and how they must be
32connected.
33
34The steps to write a `babeltrace run` command line are:
35
36. Specify which component classes to instantiate as components and
37 how. This is the 'COMPONENTS' part of the synopsis. See
38 <<create-comps,Create components>> to learn more.
39
40. Specify how to connect component instances together with one or more
41 opt:--connect options. See <<connect-comps,Connect components>> to
42 learn more.
43
44NOTE: The man:babeltrace-convert(1) command is a specialization of the
45`run` command for the very common case of converting one or more traces:
46it generates a `run` command line and executes it. You can use its
47manopt:babeltrace-convert(1):--run-args or
48manopt:babeltrace-convert(1):--run-args-0 option to make it print the
49equivalent `run` command line instead.
50
51
52[[create-comps]]
53Create components
54~~~~~~~~~~~~~~~~~
55To create a component, use the opt:--component option. This option
56specifies:
57
58* **Optional**: The name of the component instance. You can also use the
59 opt:--name option for this.
60
61* The type of the component class to instantiate: source, filter, or
62 sink.
63
64* The name of the plugin in which to find the component class to
65 instantiate.
66
67* The name of the component class to instantiate.
68
69You can use the opt:--component option multiple times to create
70multiple components. You can instantiate the same component class
71multiple times as different component instances.
72
73At any point in the command line, the opt:--base-params sets the current
74base initialization parameters and the opt:--reset-base-params resets
75them. When you specify a opt:--component option, its initial
76initialization parameters are a copy of the current base initialization
77parameters.
78
79Immediately following a opt:--component option on the command line, the
80created component is known as the _current component_ (until the next
81opt:--component option).
82
83The following, optional command-line options apply to the current
84component:
85
86opt:--name='NAME'::
87 Set the name of the current component to 'NAME'.
88
89opt:--params='PARAMS'::
90 Add 'PARAMS' to the initialization parameters of the current
91 component. If 'PARAMS' contains a key which exists in the current
92 component's initialization parameters, this parameter is replaced.
93+
94See <<params-fmt,Parameters format>> for the format of 'PARAMS'.
95
96opt:--key='KEY' followed with opt:--value='VALUE'::
97 Set the current component's initialization parameter named 'KEY' to
98 the string value 'VALUE'. If 'KEY' exists in the current component's
99 initialization parameters, the parameter is replaced.
100
101
102[[connect-comps]]
103Connect components
104~~~~~~~~~~~~~~~~~~
105The components which you create from component classes with the
106opt:--component option (see <<create-comps,Create components>>) can
107create input and output _ports_ depending on their type. An output port
108is where notifications, like trace events, are sent. An input port is
109where notifications are received. For a given component instance, each
110port has a unique name.
111
112The purpose of the `run` command is to create a trace processing graph,
113that is, to know which component ports to connect together. The command
114achieves this with the help of the connection rules that you provide
115with the opt:--connect option.
116
117The format of a connection rule (the argument of the opt:--connect
118option) is:
119
120[verse]
121__UP-COMP-PAT__[.__UP-PORT-PAT__]:__DOWN-COMP-PAT__[.__DOWN-PORT-PAT__]
122
123'UP-COMP-PATH'::
124 Upstream component name pattern.
125
126'UP-PORT-PAT'::
127 Upstream port name pattern.
128
129'DOWN-COMP-PATH'::
130 Downstream component name pattern.
131
132'DOWN-PORT-PAT'::
133 Downstream port name pattern.
134
135When a source or filter component adds a new output port within the
136processing graph, the `run` command does the following to find an
137input port to connect it to:
138
139----
140For each connection rule:
141 If the output port's component's name matches UP-COMP-PAT and
142 the output port's name matches UP-PORT-PAT:
143 For each component COMP in the processing graph:
144 If the name of COMP matches DOWN-COMP-PAT:
145 Select the first input port of COMP of which the name
146 matches DOWN-PORT-PAT, or fail with no match.
147Fail with no match.
148----
149
150__UP-COMP-PAT__, __UP-PORT-PAT__, __DOWN-COMP-PAT__, and
151__DOWN-PORT-PAT__ are globbing patterns where only the wildcard
152character, `*`, is special: it matches zero or more characters. You must
153escape the `*`, `?`, `[`, `.`, `:`, and :bs: characters with :bs:.
154
155When you do not specify __UP-PORT-PAT__ or __DOWN-PORT-PAT__, they are
156equivalent to `*`.
157
158You can leverage this connection mechanism to specify fallbacks with a
159careful use of wildcards. For example:
160
161----
162--connect='A.out*:B.in*' --connect=A:B --connect='*:C'
163----
164
165With those connection rules:
166
167* Any output port of which the name starts with `out` of component `A`
168 is connected to the first input port of which the name starts with
169 `in` of component `B`.
170
171* Any other output port of component `A` is connected to the first
172 available input port of component `B`.
173
174* Any other output port (of any component except `A`) is connected to
175 the first available input port of component `C`.
176
177The `run` command fails when it cannot find an input port to which to
178connect a created output port using the provided connection
179rules.
180
181See <<examples,EXAMPLES>> for more examples.
182
183
184include::common-cmd-params-format.txt[]
185
186include::common-cmd-plugin-path.txt[]
187
188
189OPTIONS
190-------
191include::common-gen-options.txt[]
192
193
194Component creation
195~~~~~~~~~~~~~~~~~~
196opt:-b 'PARAMS', opt:--base-params='PARAMS'::
197 Set the current base parameters to 'PARAMS'. You can reset the
198 current base parameters with the opt:--reset-base-params option.
199 See <<params-fmt,Parameters format>> for the format of 'PARAMS'.
200
201opt:-c $$[$$__NAME__:]'TYPE'.'PLUGIN'.'COMPCLS', opt:--component=$$[$$__NAME__:]'TYPE'.'PLUGIN'.'COMPCLS'::
202 Create a component initially named 'NAME' (if specified) from the
203 component class of type 'TYPE' named 'COMPCLS' found in the plugin
204 named 'PLUGIN', and set it as the current component.
205+
206The available values for 'TYPE' are:
207+
208--
209`source`::
210`src`::
211 Source component class.
212
213`filter`::
214`flt`::
215 Filter component class.
216
217`sink`::
218 Sink component class.
219--
220+
221The initial initialization parameters of this component are copied from
222the current base initialization parameters (see the opt:--base-params
223option).
224
225opt:--key='KEY'::
226 Set the current parameter key to 'KEY'. The next opt:--value option
227 uses this key to add a parameter to the current component.
228
229opt:--name='NAME'::
230 Set the name of the current component to 'NAME'. The names of all
231 the components in the processing graph must be unique.
232
233opt:-p 'PARAMS', opt:--params='PARAMS'::
234 Add 'PARAMS' to the initialization parameters of the current
235 component. If 'PARAMS' contains a key which exists in the current
236 component's initialization parameters, replace the parameter.
237 See <<params-fmt,Parameters format>> for the format of 'PARAMS'.
238
239opt:-r, opt:--reset-base-params::
240 Reset the current base parameters. You can set the current base
241 parameters with the opt:--base-params option.
242
243opt:-v 'VALUE', opt:--value='VALUE'::
244 Add a parameter to the current component's initialization parameters
245 of which the key is the argument of the last opt:--key option and
246 the string value is 'VALUE'. If the current component's
247 initialization parameters already contain a key named 'KEY', replace
248 the parameter.
249
250
251Component connection
252~~~~~~~~~~~~~~~~~~~~
d5128b09 253opt:-x 'CONN-RULE', opt:--connect='CONN-RULE'::
838dd456
PP
254 Add the connection rule 'CONN-RULE'. See
255 <<connect-comps,Connect components>> for the format of 'CONN-RULE'.
256
257
258Graph configuration
259~~~~~~~~~~~~~~~~~~~
260opt:--retry-duration='DURUS'::
261 Set the duration of a single retry to 'DURUS'{nbsp}µs when a
262 component reports "try again later" (busy network or file system,
263 for example).
264+
265Default: 100000 (100{nbsp}ms).
266
267
268include::common-plugin-path-options.txt[]
269
270include::common-cmd-info-options.txt[]
271
272
273[[examples]]
274EXAMPLES
275--------
276.Create a single-port source component and a single-port sink component and connect them.
277====
278[role="term"]
279----
280$ babeltrace run --component=A:src.plug.my-src \
281 --component=B:sink.plug.my-sink \
282 --connect=A:B
283----
284
285Possible resulting graph:
286
287----
288+-----------------+ +-------------------+
289| src.plug.my-src | | sink.plug.my-sink |
290| [A] | | [B] |
291| | | |
292| out @--->@ in |
293+-----------------+ +-------------------+
294----
295====
296
297.Use the opt:--name option to name the current component.
298====
299[role="term"]
300----
301$ babeltrace run --component=src.plug.my-src --name=the-source \
302 --component=the-sink:sink.plug.my-sink \
303 --connect=the-source:the-sink
304----
305====
306
307.Use the opt:--params option to set the current component's initialization parameters.
308====
309In this example, the opt:--params option only applies to component
310`the-source`.
311
312[role="term"]
313----
314$ babeltrace run --component=the-source:src.my-plugin.my-src \
315 --params='offset=123, flag=true' \
316 --component=the-sink:sink.my-plugin.my-sink \
317 --connect=the-source:the-sink
318----
319====
320
321.Use the opt:--key and opt:--value options to set a current component's initialization parameter.
322====
323[role="term"]
324----
325$ babeltrace run --component=the-source:src.my-plugin.my-src \
326 --key=path --value ~/my-traces/the-trace
327 --component=the-sink:sink.my-plugin.my-sink \
328 --connect=the-source:the-sink
329----
330====
331
332.Use the opt:--base-params and opt:--reset-base-params options to set and reset the current base initialization parameters.
333====
334In this example, the effective initialization parameters of the
335created components are:
336
337* Component `A`: `offset=1203, flag=false`
338* Component `B`: `offset=1203, flag=true, type=event`
339* Component `C`: `ratio=0.25`
340
341[role="term"]
342----
343$ babeltrace run --base-params='offset=1203, flag=false' \
344 --component=A:src.plugin.compcls \
345 --component=B:flt.plugin.compcls \
346 --params='flag=true, type=event' \
347 --reset-base-params \
348 --component=C:sink.plugin.compcls \
349 --params='ratio=0.25' \
350 --connect=A:B --connect=B:C
351----
352====
353
354.Specify a component connection fallback rule.
355====
356In this example, any `A` output port of which the name starts with
357`foo` is connected to a `B` input port of which the name starts with
358`nin`. Any other `A` output port is connected to a `B` input port of
359which the name starts with `oth`.
360
361The order of the opt:--connect options is important here: the opposite
362order would create a system in which the first rule is always satisfied,
363and _any_ `A` output port, whatever its name, would be connected to a
364`B` input port with a name that starts with `oth`.
365
366[role="term"]
367----
368$ babeltrace run --component=A:src.plug.my-src \
369 --component=B:sink.plug.my-sink \
370 --connect='A.foo*:B:nin*' --connect='A:B.oth*'
371----
372
373Possible resulting graph:
374
375----
376+-----------------+ +-------------------+
377| src.plug.my-src | | sink.plug.my-sink |
378| [A] | | [B] |
379| | | |
380| foot @--->@ nine |
381| foodies @--->@ ninja |
382| some-port @--->@ othello |
383| hello @--->@ other |
384+-----------------+ +-------------------+
385----
386====
387
388
389include::common-cli-env.txt[]
390
391include::common-cli-files.txt[]
392
393include::common-cmd-footer.txt[]
394
395
396SEE ALSO
397--------
398man:babeltrace(1),
399man:babeltrace-convert(1),
400man:babeltrace-intro(7)
This page took 0.037775 seconds and 4 git commands to generate.