tests: make UUIDs under data/ctf-traces/intersection unique
[babeltrace.git] / doc / man / babeltrace2-intro.7.txt
CommitLineData
a8be4294 1babeltrace2-intro(7)
0659f3af
PP
2===================
3:manpagetype: man page
4:revdate: 5 October 2017
5
6
7NAME
8----
a8be4294 9babeltrace2-intro - Introduction to Babeltrace
0659f3af
PP
10
11
12DESCRIPTION
13-----------
14This man page is an introduction to the Babeltrace project.
15
16The <<what-is,WHAT IS BABELTRACE?>> section lists the parts of the
17project and shows the major changes from Babeltrace{nbsp}1 to
18Babeltrace{nbsp}2 while the <<concepts,BABELTRACE CONCEPTS>> section
19defines the core concepts of Babeltrace.
20
21The <<graph-repr,TRACE PROCESSING GRAPH REPRESENTATION>> section shows
22how some <<concepts,concepts>> are visually represented in other
23Babeltrace man pages.
24
25
26[[what-is]]
27WHAT IS BABELTRACE?
28-------------------
29Babeltrace is an open-source software project of which the purpose is
30to process or convert
31https://en.wikipedia.org/wiki/Tracing_(software)[traces].
32
33The Babeltrace project includes the following parts:
34
a8be4294 35[[libbabeltrace2]]Babeltrace library (libbabeltrace2)::
0659f3af
PP
36 A shared library with a C API.
37+
a8be4294 38With libbabeltrace2, you can programmatically create <<plugin,plugins>>
0659f3af
PP
39and <<comp-cls,component classes>>, build and run <<graph,processing
40graphs>>, and more (see the <<concepts,BABELTRACE CONCEPTS>> section for
41more details about those concepts). All the other Babeltrace parts rely
42on this library.
43
a8be4294
MJ
44[[babeltrace2-1]]`babeltrace2` command::
45 A command-line interface which uses libbabeltrace2 to load plugins,
0659f3af
PP
46 create a trace processing graph, create components, and run the
47 graph.
48+
a8be4294 49You can also use `babeltrace2` to list the available plugins or to query
0659f3af
PP
50an object from a component class.
51+
a8be4294 52See man:babeltrace2(1).
0659f3af
PP
53
54[[python-bindings]]Babeltrace Python bindings::
55 A Python{nbsp}3 package which offers a Pythonic interface of
a8be4294 56 libbabeltrace2.
0659f3af 57+
a8be4294 58You can perform the same operations which are available in libbabeltrace2
0659f3af
PP
59with the Python bindings, but in a really easier way and with less code.
60
61Babeltrace project's plugins::
62 The Babeltrace <<plugin,plugins>> shipped with the project.
63+
a8be4294
MJ
64Those plugins are not special, in that they only rely on libbabeltrace2
65and you don't need them to use libbabeltrace2, man:babeltrace2(1), or the
0659f3af
PP
66Python bindings.
67+
68The Babeltrace project's plugins are:
69+
70--
71`ctf`::
72 Common Trace Format input/output, including the LTTng live source.
73+
a8be4294 74See man:babeltrace2-plugin-ctf(7).
0659f3af
PP
75
76`lttng-utils`::
77 Graph utilities specific to http://lttng.org/[LTTng] traces.
78+
a8be4294 79See man:babeltrace2-plugin-lttng-utils(7).
0659f3af
PP
80
81`text`::
82 Text input/output.
83+
a8be4294 84See man:babeltrace2-plugin-text(7).
0659f3af
PP
85
86`utils`::
87 Graph utilities (muxer, trimmer, counter, dummy sink).
88+
a8be4294 89See man:babeltrace2-plugin-utils(7).
0659f3af
PP
90--
91
92Python plugin provider::
a8be4294 93 A shared library which libbabeltrace2 tries to load to add support
0659f3af
PP
94 for Babeltrace plugins written in Python.
95+
96The package you use to write a Python Babeltrace plugin is the one
97provided by the Python bindings.
98
99
100Changes since Babeltrace{nbsp}1
101~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
102This man page is an introduction to Babeltrace{nbsp}2, a rewrite of
103Babeltrace{nbsp}1 with a focus on extensibility and flexibility.
104
105Babeltrace{nbsp}1 exists since 2010. The major improvements brought by
106Babeltrace{nbsp}2 are:
107
108* Full plugin support: any user can distribute a Babeltrace plugin and,
a8be4294
MJ
109 as long as <<libbabeltrace2,libbabeltrace2>> finds it, any application
110 linked to libbabeltrace2 can load it and use it.
0659f3af
PP
111+
112Plugins are not just input and output formats: they provide source,
113filter, and sink <<comp-cls,component classes>> so that you can connect
114specialized, reusable components together in a graph to create a
115customized trace conversion or analysis device.
116
a8be4294 117* In order to support user components, all the objects of libbabeltrace2
0659f3af
PP
118 have a reference count. The possible reference cycles are handled
119 internally so that the library's API is clean and predictable. The two
120 reference counting functions, `bt_get()` and `bt_put()`, are all you
121 need to manage the lifetime of any Babeltrace object.
122
123* All the parts of the Babeltrace project run on the major operating
124 systems, including Windows and macOS.
125
126
127[[concepts]]
128BABELTRACE CONCEPTS
129-------------------
130This section defines the main concepts of the Babeltrace project. These
131concepts translate into types and functions in
a8be4294 132<<libbabeltrace2,libbabeltrace2>> and its <<python-bindings,Python
0659f3af 133bindings>>, but also as command-line actions and options in the
a8be4294 134<<babeltrace2-1,`babeltrace2` command>>. The other Babeltrace man pages
0659f3af
PP
135assume that you are familiar with the following definitions.
136
137Some Babeltrace concepts are interdependent: it is normal to jump from
138one definition to another to understand the big picture.
139
140[[comp-cls]]Component class::
141 A reusable class from which you can instantiate one or more
142 <<comp,component>> instances.
143+
144There are three types of component classes used to instantiate the three
145types of components (source, filter, and sink).
146+
147A component class provides methods, one of which is an initialization
148method, or constructor, to create a component. You pass _initialization
149parameters_ to this method to customize the created component. For
150example, the initialization method of the compcls:src.ctf.fs component
151class accepts a mandatory manparam:source.ctf.fs:path parameter which is
152the file system path to the trace(s). It also accepts an optional
153manparam:source.ctf.fs:clock-class-offset-ns parameter which is an
154offset, in nanoseconds, to add to all the clock classes found in the
155traces's metadata.
156
157[[comp]]Component::
158 A node within a <<graph,trace processing graph>>.
159+
160There are three types of components:
161+
162--
163Source component::
164 An input component which produces <<notif,notifications>>.
165+
166Examples: CTF files input, log file input, LTTng-live input, random
167event generator.
168
169Filter component::
170 An intermediate component which can discard the notifications it
171 receives, transform them, augment them, sort them, or create new
172 ones.
173+
174Examples: filter which removes notifications based on an expression,
175filter which adds debugging information to selected events, notification
176multiplexer, trace trimmer.
177
178Sink component::
179 An output component which consumes notifications and usually writes
180 them to one or more formatted files.
181+
182Examples: log file output, CTF files output, text output on the
183console.
184--
185+
186Components are connected together within a <<graph,trace processing
187graph>> through their <<port,ports>>. Source components have output
188ports, sink components have input ports, and filter components have
189both.
190+
191A component is the instance of a <<comp-cls,component class>>. The terms
192_component_ and _component instance_ are equivalent.
193+
194Within a trace processing graph, each component has a unique name. This
195is not the name of its component class, but an instance name. If `human`
196is a component class name, than `John` could be a component name.
197
198[[port]]Port::
199 A connection point, on a <<comp,component>>, from which are sent or
200 to which are received <<notif,notifications>> when the <<graph,trace
201 processing graph>> is running.
202+
203An output port is where notifications are sent. An input port is where
204notifications are received. Source components have output ports, sink
205components have input ports, and filter components have both.
206+
207An output port can only be connected to a single input port at a given
208time.
209+
210A filter or sink component receiving notifications from its input ports
211is said to _consume_ notifications.
212+
213The link between an output port and input port is a <<conn,connection>>.
214+
215A component can dynamically add and remove ports while a graph is
216running. For example, a compcls:filter.utils.muxer component always
217makes sure that it has at least one available input port.
218
219[[conn]]Connection::
220 The link between an output <<port,port>> and an input port through
221 which <<notif,notifications>> flow when a <<graph,trace processing
222 graph>> is running.
223
224[[notif]]Notification::
225 An atomic element sent from an output <<port,port>> to an
226 input port.
227+
228A source <<comp,component>> produces notifications, while a sink
229component consumes them. A filter component can both consume and
230produce notifications.
231+
232The main types of notifications are:
233+
234--
235Event::
236 A trace event record within a packet.
237
238Packet beginning::
239 The beginning of a packet within a stream.
240+
241A packet is a container of events.
242
243Packet end::
244 The end of a packet within a stream.
245
246Stream beginning::
247 The beginning of a stream.
248+
249A stream is a container of packets.
250+
251Usually, a given source component's output port sends packet and
252event notifications which belong to a single stream.
253
254Stream end::
255 The end of a stream.
256
257Discarded events::
258 A count of discarded events within a given time interval for a given
259 stream.
260
261Discarded packets::
262 A count of discarded packets within a given time interval for a
263 given stream.
264--
265
266[[graph]]Trace processing graph::
267 A https://en.wikipedia.org/wiki/Filter_graph[filter graph] where
268 nodes are <<comp,components>> and <<notif,notifications>> flow from
269 output <<port,ports>> to input ports.
270+
271You can build a trace processing graph with
a8be4294
MJ
272<<libbabeltrace2,libbabeltrace2>>, with the <<python-bindings,Babeltrace
273Python bindings>>, or with the man:babeltrace2-run(1) and
274man:babeltrace2-convert(1) commands.
0659f3af
PP
275+
276When you _run_ a trace processing graph, the sink components consume
277notifications from their input ports, making all the graph's components
278work one notification at a time to perform the trace conversion or
279analysis.
280
281[[plugin]]Plugin::
282 A container of <<comp-cls,component classes>> as a shared library.
283+
284Each component class within a plugin has a type (source, filter, or
285sink) and a name. The type and name pair is unique within a given
286plugin.
287+
a8be4294 288<<libbabeltrace2,libbabeltrace2>> can load a plugin (`.so` or `.dll` file)
0659f3af
PP
289at run time: the result is a plugin object in which you can find a
290specific component class and instantiate it within a <<graph,trace
291processing graph>> as a <<comp,component>>.
292+
a8be4294 293The <<babeltrace2-1,`babeltrace2` command>> uses the
0659f3af
PP
294'TYPE.PLUGIN.COMPCLS' format to identify a specific component
295class within a specific plugin. 'TYPE' is either `source`, `filter`,
296or `sink`.
297+
298You can list the available Babeltrace plugins with the
a8be4294 299man:babeltrace2-list-plugins(1) command.
0659f3af
PP
300
301[[query]]Query::
302 An operation with which you can get a named object from a
303 <<comp-cls,component class>>, possibly with the help of query
304 parameters.
305+
306The plain text metadata stream of a CTF trace and the available LTTng
307live sessions of a given LTTng relay daemon are examples of queries.
308+
a8be4294 309You can use the man:babeltrace2-query(1) command to query a component
0659f3af
PP
310class's object.
311
312
313[[graph-repr]]
314TRACE PROCESSING GRAPH REPRESENTATION
315-------------------------------------
316In the Babeltrace man pages, a component is represented with a box. The
317box has the <<comp-cls,component class>> type, <<plugin,plugin>> name,
318and component class name at the top. Just below, between square
319brackets, is its component instance name within the <<graph,trace
320processing graph>>. Each <<port,port>> is represented with an `@` symbol
321on the edge of the component box with its name inside the box. Output
322ports are on the right edge while input ports are on the left edge.
323
324For example, here's a source component box:
325
326----
327+------------+
328| src.ctf.fs |
329| [my-src] |
330| |
331| stream0 @
332| stream1 @
333| stream2 @
334+------------+
335----
336
337This one is an instance of the compcls:src.ctf.fs component class named
338`my-src`. It has three output ports named `stream0`, `stream1`, and
339`stream2`.
340
341A trace processing graph is represented with multiple component boxes
342connected together. The <<conn,connections>> are arrows from output
343ports to input ports.
344
345For example, here's a simple conversion graph:
346
347----
348+------------+ +-----------------+ +------------------+
349| src.ctf.fs | | flt.utils.muxer | | sink.text.pretty |
350| [ctf] | | [muxer] | | [text] |
351| | | | | |
352| stream0 @--->@ in0 out @--->@ in |
353| stream1 @--->@ in1 | +------------------+
354| stream2 @--->@ in2 |
355+------------+ @ in3 |
356 +-----------------+
357----
358
359Note that input port `in3` of component `muxer` is not currently
360connected in this example.
361
362Sometimes, we symbolically represent other resources which are consumed
363from or produced by components. In this case, arrows are used, but they
364do not go to or from port symbols (`@`). For example, in the graph above,
365the `ctf` component consumes a CTF trace and the `text` component
366prints to the console, so here's a more complete diagram:
367
368----
369 CTF trace
370 |
371.------'
372| +------------+ +-----------------+ +------------------+
373| | src.ctf.fs | | flt.utils.muxer | | sink.text.pretty |
374'->| [ctf] | | [muxer] | | [text] |
375 | | | | | |
376 | stream0 @--->@ in0 out @--->@ in |
377 | stream1 @--->@ in1 | +--+---------------+
378 | stream2 @--->@ in2 | |
379 +------------+ @ in3 | '---> Console
380 +-----------------+
381----
382
383Here's another example of a more complex graph which splits a specific
384stream using some criteria:
385
386----
387+------------+ +-----------------+ +------------------+
388| src.ctf.fs | | flt.utils.muxer | | sink.text.pretty |
389| [ctf-in] | | [muxer] | | [text] |
390| | | | | |
391| stream0 @--->@ in0 out @--->@ in |
392| stream1 @--->@ in1 | +------------------+
393| stream2 @-. @ in2 |
394+------------+ | +-----------------+ +-------------+
395 | | sink.ctf.fs |
396 | | [ctf-out0] |
397 | +-------------------+ | |
398 | | flt.some.splitter | .->@ in |
399 | | [splitter] | | +-------------+
400 | | | |
401 '->@ in A @-' +-------------+
402 | B @-. | sink.ctf.fs |
403 +-------------------+ | | [ctf-out1] |
404 | | |
405 '->@ in |
406 +-------------+
407----
408
409
410include::common-footer.txt[]
411
412
413SEE ALSO
414--------
a8be4294 415man:babeltrace2(1)
This page took 0.053611 seconds and 4 git commands to generate.