Philippe Proulx [Sat, 13 May 2017 00:34:50 +0000 (20:34 -0400)]
Fix possible leaks in graph's current design
There was a possible leak when, for example:
* The user has a reference to the graph.
* The graph holds its child sink component.
* The sink component has a reference to a notification iterator.
* The notification iterator has a reference to the source component.
* The source component has a reference to its parent, the graph, because
its reference count is 1 (owned by the notification iterator).
This forms a cycle: sink component owns the notification iterator, which
owns the source component, which owns the graph, which holds the sink
component.
To break this cycle and still guarantee that the lifetime of a
notification iterator's upstream component is equal to or longer than
this iterator's lifetime, we split the notification iterator's
destruction and finalization (user's finalization method) phases. In
other words, a notification iterator can be finalized without being
destroyed. However it is guaranteed that it is always finalized once
destroyed.
A connection keeps a set of created notification iterators (weak
references). There are two possible paths to finalize a notification
iterator:
1. The graph still exists and is not being destroyed, and the final
reference to the notification iterator is put: the notification
is destroyed, and since it has not been finalized yet, it's
finalized during that phase.
2. The graph is being destroyed, and an owner (or more) still owns a
reference to the notification iterator. The graph's destructor first
destroys the graph's connections. Each connection finalizes each
notification iterator in its list, but does not destroy them.
The notification iterators are marked as finalized. Eventually the
graph destroys its components, some of which could put the last
reference to a notification iterator: the notification iterator is
destroyed, but not finalized twice.
When a notification iterator is marked as finalized, calling its "next"
method returns the new BT_NOTIFICATION_ITERATOR_STATUS_CANCELED status
when its queue is empty (instead of BT_NOTIFICATION_ITERATOR_STATUS_END).
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Sat, 13 May 2017 00:33:32 +0000 (20:33 -0400)]
BT_GRAPH_STATUS_CANCELED is not an error, thus use a positive value
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Fri, 25 Nov 2016 21:25:14 +0000 (16:25 -0500)]
Implement ctf.lttng-live component
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Thu, 13 Apr 2017 16:02:55 +0000 (12:02 -0400)]
Fix: IR visitor: error msg printing
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Wed, 30 Nov 2016 22:32:23 +0000 (17:32 -0500)]
Move print.h header to upper level dir
Can be used by both fs and lttng-live.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Fri, 12 May 2017 19:38:47 +0000 (15:38 -0400)]
utils.muxer: fix ownership of objects
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 11 May 2017 21:54:10 +0000 (17:54 -0400)]
Add graph cancellation API
With this API you can cancel a graph with bt_graph_cancel() and
check if a graph is canceled with bt_graph_is_canceled().
A canceled graph is used to indicate to a contained component or
notification iterator if it should retry or not when a system call is
interrupted. This exists mostly to support a clean termination when we
get SIGINT, but with debugger support (a system call is interrupted when
the debugger sends SIGCONT; in this case we need to retry the system
call).
Cancelling a graph also makes bt_graph_run() quit before the next
sink consuming iteration.
It is not allowed to run a canceled graph again. Once it is canceled,
it's dead for good.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 11 May 2017 21:44:25 +0000 (17:44 -0400)]
port.{h,c}: use `bt_bool` instead of `int` where appropriate
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 11 May 2017 21:41:30 +0000 (17:41 -0400)]
ir: utils: use `bt_bool` instead of `int` where appropriate
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 11 May 2017 21:40:55 +0000 (17:40 -0400)]
ir: fields/field-types: use `bt_bool` instead of `int` where appropriate
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 11 May 2017 21:21:26 +0000 (17:21 -0400)]
ir: clock class: use bt_bool instead of int for boolean properties
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 11 May 2017 21:12:46 +0000 (17:12 -0400)]
Do not use `bool` type; use new `bt_bool` instead
There are possible ABI incompatibilities between C99's `bool` (`_Bool`)
type and C++'s `bool` type, and also between different compilers. For
this reason we choose to use our own boolean type, `bt_bool`, which is
defined as `int`. `BT_FALSE` and `BT_TRUE` are our own definitions for
false and true.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 11 May 2017 17:26:34 +0000 (13:26 -0400)]
Update include/babeltrace/babeltrace.h
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 11 May 2017 17:24:53 +0000 (13:24 -0400)]
Add extras/gen-babeltrace-h.py: include/babeltrace/babeltrace.h generator
This Python 3 script reads include/Makefile.am and prints the
equivalent content of include/babeltrace/babeltrace.h. From the
source tree's root, you can use it as such:
$ python3 extras/gen-babeltrace-h.py > include/babeltrace/babeltrace.h
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 11 May 2017 17:23:19 +0000 (13:23 -0400)]
Move library's version API to include/babeltrace/version.h
Let's keep include/babeltrace/babeltrace.h a master header only.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 11 May 2017 17:03:17 +0000 (13:03 -0400)]
include/Makefile.am: add titles (comments) to groups of files
This is because I intend to use this file to automatically generate
include/babeltrace/babeltrace.h.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 11 May 2017 16:49:12 +0000 (12:49 -0400)]
Remove "end of trace" notification headers
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 11 May 2017 16:46:12 +0000 (12:46 -0400)]
Normalize public header include guards
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 11 May 2017 06:17:38 +0000 (02:17 -0400)]
lib/ref.c: add logging
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 11 May 2017 06:07:43 +0000 (02:07 -0400)]
lib/ctf-ir/clock-class.c: add logging
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 11 May 2017 05:12:20 +0000 (01:12 -0400)]
test_ctf_writer.c: remove negative index tests
The API's type for indexes is always an unsigned integer now, so we
don't need those tests anymore.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 11 May 2017 05:12:04 +0000 (01:12 -0400)]
lib/ctf-ir/attributes.c: add logging
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 11 May 2017 05:11:41 +0000 (01:11 -0400)]
ir: attributes: fix index and count integer types
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 11 May 2017 03:50:18 +0000 (23:50 -0400)]
lib/values.c: add logging
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 11 May 2017 03:49:29 +0000 (23:49 -0400)]
tests/lib/Makefile.am: fix check_ vs. noinst_ prefix
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 10 May 2017 17:35:50 +0000 (13:35 -0400)]
cli: add logging
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 10 May 2017 06:07:36 +0000 (02:07 -0400)]
common: optimize color code functions
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 8 May 2017 17:04:40 +0000 (13:04 -0400)]
Fix CLI to work with multiple ports and dynamically added ports
This patch makes the CLI actually connect component ports within the
application's graph before running it.
On the command line, you specify the connections like you used to,
except that the ports are not specific ports anymore: they are globbing
patterns (only the `*` special character is supported as of this
version) which specify: when a new upstream port matches the left part
of the connection argument (specific component and port name globbing
pattern), connect it to the first port that matches the right part
(specific component and port name globbing pattern). For example:
src.*meow*:sink.master-*
would make babeltrace(1) connect all the ports of the component instance
`src` of which the names match `*meow*` to the next available port
of the instance `sink` of which the name matches `master-*`.
This mechanism allows to connect specific ports together, or to connect
group of ports or any ports using wildcards.
The code for the globbing pattern matching was grabbed from the
LTTng-UST project and I'm one of the copyright holders anyway.
This patch also adds a --retry-duration option to the `connect` and
`run` commands to specify how many microseconds the program should
wait when the graph returns BT_GRAPH_STATUS_AGAIN (do not wait when 0).
The default duration is 100 ms.
Some files are renamed to match what they really are. The concept of a
Babeltrace configuration (`bt_config`) is beyond the command-line
arguments: it could eventually be read from a configuration file, etc.
babeltrace-cfg-cli-args.c is a module which can create a Babeltrace
configuration out of command-line arguments.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 8 May 2017 17:04:03 +0000 (13:04 -0400)]
Add logging API (internal to log, public to set the current log level)
See doc/logging-guide.adoc which explains the whole logging API, how to
set and initialize the log levels, how to write logging statements, etc.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 8 May 2017 23:40:27 +0000 (19:40 -0400)]
bt_common_shell_quote(): accept new parameter `with_single_quotes`
This parameter indicates if the function must put the initial and final
`'` character itself or if it's the caller's job.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Fri, 5 May 2017 20:49:32 +0000 (16:49 -0400)]
Rename tests/bin -> tests/cli
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Fri, 5 May 2017 20:47:17 +0000 (16:47 -0400)]
configure.ac: define BT_ENABLE_DEBUG_INFO depending on the support
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Fri, 5 May 2017 20:46:41 +0000 (16:46 -0400)]
ctf.fs source: metadata: fix error paths
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Fri, 5 May 2017 20:45:53 +0000 (16:45 -0400)]
tests/bin/test_convert_args: fix after updating CLI
Mostly component instance names that are changed.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Fri, 5 May 2017 20:45:11 +0000 (16:45 -0400)]
tests: put TESTS list in each Makefile.am
So that you can do `make check` in any subdirectory to run only those
tests.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Fri, 5 May 2017 19:29:52 +0000 (15:29 -0400)]
plugins/ctf/fs-src/data-stream.c: fix text width
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Fri, 5 May 2017 17:56:03 +0000 (13:56 -0400)]
babeltrace-internal.h: remove unused declarations
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Fri, 5 May 2017 17:55:51 +0000 (13:55 -0400)]
Do not use printf_warning() in the library
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Fri, 5 May 2017 17:54:23 +0000 (13:54 -0400)]
Rename writer.writer -> ctf.fs (sink) and standardize plugin descriptions
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Fri, 5 May 2017 17:12:29 +0000 (13:12 -0400)]
Rename debug_info.debug_info -> lttng-utils.debug-info
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Fri, 5 May 2017 16:53:54 +0000 (12:53 -0400)]
debug-info.debug-info: do not use global opt_* symbols anymore
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 2 May 2017 21:19:53 +0000 (17:19 -0400)]
Fix: ir: bt_ctf_field_type_variant_validate(): do not compare to tag length
Because the same label can map to multiple values in an enumeration FT,
the number of fields in a variant FT does not need to be the same as the
number of mappings in its tag FT for the variant FT to be considered
valid.
Relax this by only making sure that each tag FT mapping has an entry in
the variant FT which shares the same name. Unused variant FT
fields/choices are not a problem per se, just a waste of space.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 2 May 2017 20:42:16 +0000 (16:42 -0400)]
Subscribe to notifications when creating a notif. iterator
bt_private_connection_create_notification_iterator() now accepts a new
parameter which is a BT_NOTIFICATION_TYPE_SENTINEL-terminated array of
notification types to subscribe to. It is guaranteed that, after any
bt_notification_iterator_next() called on the created iterator (if the
status is BT_NOTIFICATION_ITERATOR_STATUS_OK), the following call to
bt_notification_iterator_get_notification() returns a notification to
which the iterator is subscribed.
You can pass NULL to the notification types parameter of
bt_private_connection_create_notification_iterator() to subscribe to all
existing notifications (including the ones that will be added to the
following versions of the library).
The use case behind the subscription mechanism is for a notification
iterator to avoid the generation of automatic notifications when the
iterator's user does not expect them anyway. This should be the case of
some filters and sinks, text.pretty being a current example (only needs
event notifications).
Tests and existing plugins are updated accordingly.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 2 May 2017 19:27:45 +0000 (15:27 -0400)]
notif-iter.c: fix warnings
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 2 May 2017 19:19:34 +0000 (15:19 -0400)]
Make bt_ctf_event_class_create() create an empty context FT
This is in line with bt_ctf_trace_create() and
bt_ctf_stream_class_create_empty(). You can get the empty context FT
with bt_ctf_event_class_get_context_type() after creation and add fields
to it.
Update tests accordingly.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 2 May 2017 19:19:20 +0000 (15:19 -0400)]
Add bt_ctf_stream_class_create_empty()
The new bt_ctf_stream_class_create_empty() function creates a new
stream class object with its packet context, event header, and event
context field types set to empty structure field types.
This is more appropriate for source components which do not need the
default fields that bt_ctf_stream_class_create() creates.
bt_ctf_stream_class_create() is kept as is for backward compatibility
with pre-2.0 CTF writer.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 2 May 2017 18:46:37 +0000 (14:46 -0400)]
Remove BT_CTF_FIELD_TYPE_UNTAGGED_VARIANT
Also make CTF_TYPE_UNTAGGED_VARIANT have the same value as
CTF_TYPE_VARIANT: there's no distinction now.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 2 May 2017 18:27:24 +0000 (14:27 -0400)]
Internalize trace listener API and bt_ctf_trace_get_metadata_string()
Since the trace listener API is internal now, remove
test_trace_listener.c because it cannot find the function symbols.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 2 May 2017 18:17:48 +0000 (14:17 -0400)]
ir: make bt_ctf_trace_create() create an empty packet header FT
Currently bt_ctf_trace_create() creates an initial default packet header
field type with the `magic`, `uuid`, and `stream_id` fields. This is, in
fact, specific to CTF writer. Since the trace API is not public yet,
move this default packet header FT creation from bt_ctf_trace_create()
to bt_ctf_writer_create() to ensure backward compatibility.
This patch also fixes a few things in the API doc. of trace.h.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 2 May 2017 17:56:30 +0000 (13:56 -0400)]
utils.muxer: add and handle `ignore-absolute` parameter
The utils.muxer's `ignore-absolute` parameter controls whether sorting
with non-absolute clock classes is an error or not. It is false by
default (non-absolute clock classes are not permitted).
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 2 May 2017 17:14:20 +0000 (13:14 -0400)]
Remove default port API
With the possibility of creating new ports for the whole lifetime of
a component, default ports aren't so useful and their name is
arbitrary. We don't need this for the 2.0 target.
The existing component classes are changed like so:
* debug-info.debug-info [filter]: one `in` input port and one `out`
output port
* text.pretty [sink]: one `in` input port
* utils.dummy [sink]: one `in` input port
* utils.trimmer [filter]: one `in` input port and one `out` output port
* writer.writer [sink]: one `in` input port
Tests are updated accordingly.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 2 May 2017 16:44:49 +0000 (12:44 -0400)]
trace.h: API doc: do not mention listener (now internal)
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 2 May 2017 16:43:01 +0000 (12:43 -0400)]
visitor-generate-ir.c: fix some error reporting terms
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 2 May 2017 16:34:16 +0000 (12:34 -0400)]
visitor-generate-ir.c: set trace object's UUID
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 2 May 2017 16:33:19 +0000 (12:33 -0400)]
Rename bt_ctf_trace_get_byte_order() -> bt_ctf_trace_get_native_byte_order()
Also fix associated API doc.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 2 May 2017 16:18:38 +0000 (12:18 -0400)]
ir: add trace UUID getter and setter
The trace object's creation does not generate a UUID anymore: a new
trace starts with an unset UUID. When you create a CTF writer object, it
creates a trace object, generates a UUID, and set its trace's UUID. This
ensures backward compatibility with pre-2.0 CTF writer while allowing a
new trace object to have no UUID.
Tests are updated accordingly.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 2 May 2017 05:27:58 +0000 (01:27 -0400)]
utils.muxer: fix bad behaviour caused by notification buffering
In some cases, buffering a single notification (that is, selecting in
advance what will be the next notification returned by the next call to
the "next" method) can introduce a bad behaviour in a utils.muxer
component.
For example, it is possible that an upstream notification iterator's
"next" method be called twice without any explicit sleep between both
calls even if the first call returned the
BT_NOTIFICATION_ITERATOR_STATUS_AGAIN status.
This patch fixes this so that there's no more buffering: the youngest
notification is chosen in the scope of the "next" method, with any
required newly connected port handling and upstream iterators to advance
done before, and any BT_NOTIFICATION_ITERATOR_STATUS_AGAIN status is
returned directly.
For this we introduce the concept of validity for an upstream
notification iterator. A valid upstream notification iterator is one of
which the current notification must be considered for the next muxing
operation. An invalid upstream notification iterator must be validated
(its "next" method must be called and return
BT_NOTIFICATION_ITERATOR_STATUS_OK) before we can consider its current
notification. In the muxer notification iterator's "next" method, the
youngest notification is chosen only when all the non-terminated
upstream notification iterators are valid, and only when there's no
unhandled newly connected ports left. When the notification is taken
from the youngest upstream notification iterator, it is invalidated: it
must be validated again during the following "next" method call.
Tests are updated accordingly. Two generated
BT_NOTIFICATION_ITERATOR_STATUS_AGAIN statuses in the source were
necessary for one expected BT_NOTIFICATION_ITERATOR_STATUS_AGAIN status
returned by the muxer: now the generated sequence of notifications and
what the sink sees are perfectly synchronized.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 27 Apr 2017 23:17:04 +0000 (19:17 -0400)]
Set private port's user data on creation
With separate port creation and user data setting calls, the following
scenario is problematic:
Source adds a port (private data is not set yet)
Graph user's "port added" callback is called
This callback connects the new port to a sink port
This sink's "port connected" method is called
This sink creates a notification iterator on the connected
port's connection
The source's notification iterator initialization method
is called with the added port with NO private data yet
With this change, it is guaranteed that as soon as the port can be
accessed by any user, its private data is set.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 27 Apr 2017 23:06:09 +0000 (19:06 -0400)]
Remove bt_ctf_stream_class_get_event_class_by_name()
CTF allows two event classes of the same stream class to have the same
name, but all event classes must have a unique ID. Remove
bt_ctf_stream_class_get_event_class_by_name() because this would need to
return a set of event classes, not just one, and this feature is not
strictly needed for the 2.0 target.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 27 Apr 2017 21:27:43 +0000 (17:27 -0400)]
test_trace_listener.c: fix: set trace's native byte order
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 27 Apr 2017 21:27:23 +0000 (17:27 -0400)]
Standardize *get_*() functions
Make all getters that also have a "by name" version have the
`_by_index()` suffix. Use uint64_t for all indexes.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 27 Apr 2017 18:53:16 +0000 (14:53 -0400)]
Make libctfcopytrace a convenience lib. and link to it in plugins
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 26 Apr 2017 21:30:51 +0000 (17:30 -0400)]
Standardize *get_*_count() functions
All "count" functions now return the count as an `int64_t` value,
returning -1 on error.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 26 Apr 2017 21:21:12 +0000 (17:21 -0400)]
ISO C: empty file needs at least one declaration
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 26 Apr 2017 19:19:47 +0000 (15:19 -0400)]
Rename CTF IR integer FT signedness functions to use "is"
bt_ctf_field_type_integer_get_signed() becomes
bt_ctf_field_type_integer_is_signed().
bt_ctf_field_type_integer_set_signed() becomes
bt_ctf_field_type_integer_set_is_signed().
Backward compatibility with pre-2.0 CTF writer is kept with the help
of CPP definitions.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 26 Apr 2017 19:15:17 +0000 (15:15 -0400)]
Rename bt_ctf_clock_class_get_is_absolute() -> bt_ctf_clock_class_is_absolute()
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 26 Apr 2017 19:00:34 +0000 (15:00 -0400)]
text.pretty: use "path" param. name instead of "output-path"
With "path" you can use the the --path option of babeltrace-convert(1).
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 26 Apr 2017 18:49:19 +0000 (14:49 -0400)]
Add static trace tests
Those new tests validate that you cannot indeed modify a trace (add
clock classes, add stream classes, create streams) when it's static.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 26 Apr 2017 17:18:26 +0000 (13:18 -0400)]
Add the concept of a static trace
A static trace is a frozen trace with the additional property that you
cannot call:
* bt_ctf_trace_add_stream_class()
* bt_ctf_trace_add_clock_class()
* bt_ctf_stream_create() with any stream that belongs to the trace
You can make a trace static with bt_ctf_trace_set_is_static(). This is
not a reversible operation. You can check if a trace is static with
bt_ctf_trace_is_static().
This static property can help a sink/filter component determine when the
trace is "finished", in that a static trace guarantees that its streams
are complete and there won't be more. It is up to the filter or sink
component to know when each stream is considered to be ended. The end of
a stream is provided by a notification. For example, a given filter
could receive two streams of a given trace on two different ports. In
this case, when the component gets both "stream end" notifications, and
when their trace is static, it can discard any resource associated with
this trace.
This feature is essential for a CTF writer sink component to put CTF
writer objects which are no longer needed. This is especially true when
working with a ctf.lttng-live source which "never ends": the sink
resources need to be released when it is known that there won't be more
streams for a given trace, otherwise this would be considered a leak.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 26 Apr 2017 13:14:43 +0000 (09:14 -0400)]
Add bt_ctf_trace_get_stream_count() and bt_ctf_trace_get_stream()
With the two new functions you can access the streams of a trace. The
use case is for any component to be able to check if it has received a
"stream end" notification for each stream of a given trace and discard
anything associated with this trace if it's the case.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 26 Apr 2017 12:44:15 +0000 (08:44 -0400)]
Add bt_plugin_set object
It is unusual in the Babeltrace API to return a NULL-terminated array of
objects which must be individually put by the user in addition to
calling free() on the returned array. This is what was returned by
bt_plugin_create_all_from_file(), bt_plugin_create_all_from_dir(),
and bt_plugin_create_all_from_static().
Instead, create a bt_plugin_set object of which the only purpose is to
contain plugins. A plugin set has a reference count and is not more
awkward to use than any other standard Babeltrace object.
Tests and the CLI are updated accordingly.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 26 Apr 2017 01:53:25 +0000 (21:53 -0400)]
ctf: bt_ctf_notif_iter_get_next_notification(): require CC prio. map
Since bt_notification_event_create() freezes its clock class priority
map, pass which clock class priority map to use each time you call
bt_ctf_notif_iter_get_next_notification().
In ctf.fs, it's always the same because all the clock classes are known
when the trace object is created.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 26 Apr 2017 01:33:22 +0000 (21:33 -0400)]
Use bt_clock_class_priority_map_add_clock_class() to change a priority
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 26 Apr 2017 01:24:43 +0000 (21:24 -0400)]
Add bt_clock_class_priority_map_copy()
Because bt_notification_event_create() and
bt_notification_inactivity_create() freeze their clock class priority
map on success, this utility should prove useful for components which
need to dynamically add clock classes.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 26 Apr 2017 01:22:24 +0000 (21:22 -0400)]
field-types.h: API doc: add missing prehot{}
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 26 Apr 2017 00:40:59 +0000 (20:40 -0400)]
Freeze bt_clock_class_priority_map in related notifications
We don't want the relative priorities of a notification's clock classes
(event, inactivity) to change once it's emitted.
Should a new clock class be needed (with its own priority), you should
create a new clock class priority map.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 26 Apr 2017 00:30:34 +0000 (20:30 -0400)]
Add notification iterator tests
The new tests in tests/lib/test_bt_notification_iterator.c check that
a notification iterator generates automatic notifications as expected.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 26 Apr 2017 00:15:09 +0000 (20:15 -0400)]
Notification iterator: generate automatic notifications when missing
With this patch, a notification iterator object makes sure to always
provide a valid sequence of notifications to its user (a component which
has access to the private connection). "Valid sequence of notifications"
means no "stream end" without a corresponding "stream begin", no "packet
end" without a corresponding "packet begin", event notifications are
always surrounded by "packet begin" and "packet end" notifications, and
packet notifications are always surrounded by stream notifications.
To accomplish this, each iterator has its own queue of notifications.
When it detects that one or more notifications are missing when it calls
the upstream's "next" method, it creates the missing notifications and
adds them to the queue before the upstream notification.
Upstream can still provide the "stream begin", "stream end", "packet
begin", and "packet end" notifications in the correct order. In this
case, the iterator does not generate any automatic notification.
When the upstream's "next" method returns
BT_NOTIFICATION_ITERATOR_STATUS_END, the iterator adds any missing
notifications to its queue ("packet end" and "stream end").
To know what is the current packet of a given stream, and if a given
stream exists or not from an iterator's point of view, the iterator
keeps a hash table of streams to stream states. When the iterator
creates a stream state, it gets a reference to the stream, because the
stream must exist until its "stream end" notification (which is possibly
generated by the iterator). However, when the "stream end" notification
occurs, the iterator puts the stream reference and adds to it a destroy
listener which is reponsible for removing the stream state entry when
the stream is eventually destroyed. The iterator keeps the stream state
even if the "stream end" notification was emitted because it also
validates that, for a given stream during the iterator's lifetime, only
one "stream begin" and one "stream end" notifications are emitted.
This patch adds another API constraint: within a given component, a
given stream can only be referenced by notifications that are emitted
one a given port. The first port which emits a notification which has a
reference to a stream should remain the same for the stream's lifetime.
This is enforced by keeping a hash table of component to port in each
stream. This hash table indicates which port, within a given component,
has the right to emit a notification which references this stream. This
is validated by each iterator. For each component in this hash table, a
stream adds a component destroy listener to get notified when it should
remove an entry from the hash table.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 25 Apr 2017 01:48:04 +0000 (21:48 -0400)]
Remove notification-schema.h: not needed for 2.0
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 24 Apr 2017 20:30:01 +0000 (16:30 -0400)]
utils.dummy: handle AGAIN and END statuses correctly
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 24 Apr 2017 20:29:39 +0000 (16:29 -0400)]
text.pretty: handle AGAIN status
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 24 Apr 2017 18:42:08 +0000 (14:42 -0400)]
utils.muxer: fix unhandled connected ports during notif. iter. init.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 24 Apr 2017 18:41:08 +0000 (14:41 -0400)]
text.pretty: fix handle_notification()
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 18 Apr 2017 19:02:26 +0000 (15:02 -0400)]
utils.muxer: fix behaviour with ports connected during next/init ops
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 10 Apr 2017 19:20:56 +0000 (15:20 -0400)]
Add basic utils.muxer tests
The tests in tests/plugins/test-utils-muxer.c create custom source and
sink components and connects them to a utils.muxer filter component
within a new graph.
The components do as follows:
* Source component: Depending on the current test, its notification
iterators generate specific sequences of notifications.
* Sink component: For each notification, and some specific notification
iterator statuses ("again", "end"), create a test event and append it
to a global array of test events.
Each test creates a graph, runs it, and then compares the global array
of test events against a static list of expected test events.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 6 Apr 2017 20:30:33 +0000 (16:30 -0400)]
Add utils.muxer component class
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 10 Apr 2017 19:18:14 +0000 (15:18 -0400)]
bt_plugin_create_append_all_from_dir(): use printf_verbose() instead of error
It's not a fatal error when this function cannot open a directory: it
can simply mean that this directory does not exist, but that's okay
because the function does not load plugins in this case, and it returns
an error code.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Fri, 7 Apr 2017 17:55:56 +0000 (13:55 -0400)]
Event notification: validate that CC in the CC prio map have a value
Instead of making sure that all the trace's clock classes have a value
and a priority in an event, instead make sure that all the clock classes
found in the event notification's clock class priority map have a value
in the event and that this clock class is part of the event's trace.
This makes it possible for an event to have only clock values for
relevant clock classes, not all the trace's, or even to have no value
at all.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Fri, 7 Apr 2017 17:55:31 +0000 (13:55 -0400)]
event-class-internal.h: fix include warning
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 6 Apr 2017 20:48:21 +0000 (16:48 -0400)]
text.pretty: remove unused debug info options
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 6 Apr 2017 20:43:26 +0000 (16:43 -0400)]
text.pretty: use clock class with highest priority to print the timestamp
Also, if there's no clock class in the event notification's clock class
priority map, then do not print any timestamp.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 6 Apr 2017 20:19:57 +0000 (16:19 -0400)]
Add bt_plugin_find_component_class()
This patch also renames bt_plugin_create_from_name() to bt_plugin_find()
which seems more intuitive. bt_plugin_find_component_class() simply
calls bt_plugin_find() and then gets one of its component classes.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 6 Apr 2017 18:41:12 +0000 (14:41 -0400)]
Fix: ctf: notif-iter.c: update_clock() uses the wrong FT sometimes
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 6 Apr 2017 18:40:29 +0000 (14:40 -0400)]
ctf.fs: make clock classes absolute when it's an LTTng metadata
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 6 Apr 2017 18:37:44 +0000 (14:37 -0400)]
Use the same values for different status codes
The weird values are based on the Linux error numbers
(EAGAIN, EINVAL, etc.).
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 6 Apr 2017 07:31:55 +0000 (03:31 -0400)]
Add bt_component_class_is_source/filter/sink()
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 6 Apr 2017 07:29:48 +0000 (03:29 -0400)]
Add bt_port_is_input(), bt_port_is_output()
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 6 Apr 2017 07:27:19 +0000 (03:27 -0400)]
Add bt_component_is_source(), bt_component_is_filter(), bt_component_is_sink()
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 6 Apr 2017 07:24:03 +0000 (03:24 -0400)]
Fix a few include warnings
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 6 Apr 2017 06:16:16 +0000 (02:16 -0400)]
plugins/ctf/fs/metadata.c: remove invalid return code assignment
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
This page took 0.043742 seconds and 4 git commands to generate.