lib: rename include dir to babeltrace2
[babeltrace.git] / doc / man / babeltrace-intro.7.txt
CommitLineData
0659f3af
PP
1babeltrace-intro(7)
2===================
3:manpagetype: man page
4:revdate: 5 October 2017
5
6
7NAME
8----
9babeltrace-intro - Introduction to Babeltrace
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
35[[libbabeltrace]]Babeltrace library (libbabeltrace)::
36 A shared library with a C API.
37+
38With libbabeltrace, you can programmatically create <<plugin,plugins>>
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
44[[babeltrace-1]]`babeltrace` command::
45 A command-line interface which uses libbabeltrace to load plugins,
46 create a trace processing graph, create components, and run the
47 graph.
48+
49You can also use `babeltrace` to list the available plugins or to query
50an object from a component class.
51+
52See man:babeltrace(1).
53
54[[python-bindings]]Babeltrace Python bindings::
55 A Python{nbsp}3 package which offers a Pythonic interface of
56 libbabeltrace.
57+
58You can perform the same operations which are available in libbabeltrace
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+
64Those plugins are not special, in that they only rely on libbabeltrace
65and you don't need them to use libbabeltrace, man:babeltrace(1), or the
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+
74See man:babeltrace-plugin-ctf(7).
75
76`lttng-utils`::
77 Graph utilities specific to http://lttng.org/[LTTng] traces.
78+
79See man:babeltrace-plugin-lttng-utils(7).
80
81`text`::
82 Text input/output.
83+
84See man:babeltrace-plugin-text(7).
85
86`utils`::
87 Graph utilities (muxer, trimmer, counter, dummy sink).
88+
89See man:babeltrace-plugin-utils(7).
90--
91
92Python plugin provider::
93 A shared library which libbabeltrace tries to load to add support
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,
109 as long as <<libbabeltrace,libbabeltrace>> finds it, any application
110 linked to libbabeltrace can load it and use it.
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
117* In order to support user components, all the objects of libbabeltrace
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
132<<libbabeltrace,libbabeltrace>> and its <<python-bindings,Python
133bindings>>, but also as command-line actions and options in the
134<<babeltrace-1,`babeltrace` command>>. The other Babeltrace man pages
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
272<<libbabeltrace,libbabeltrace>>, with the <<python-bindings,Babeltrace
273Python bindings>>, or with the man:babeltrace-run(1) and
274man:babeltrace-convert(1) commands.
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+
288<<libbabeltrace,libbabeltrace>> can load a plugin (`.so` or `.dll` file)
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+
293The <<babeltrace-1,`babeltrace` command>> uses the
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
299man:babeltrace-list-plugins(1) command.
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+
309You can use the man:babeltrace-query(1) command to query a component
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--------
415man:babeltrace(1)
This page took 0.040817 seconds and 4 git commands to generate.