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>
Philippe Proulx [Thu, 6 Apr 2017 06:10:42 +0000 (02:10 -0400)]
bt_component_create(): create convenient empty map parameters when NULL
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 04:54:01 +0000 (00:54 -0400)]
Add BT_NOTIFICATION_ITERATOR_STATUS_AGAIN status
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 5 Apr 2017 21:00:48 +0000 (17:00 -0400)]
test_graph_topo: test both "port connected" and "accept port connection"
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 5 Apr 2017 20:11:36 +0000 (16:11 -0400)]
Add "port connected" component class method
What used to be "accept port connection" is now split in "accept port
connection" and "port connected". The latter confirms that the two ports
are connected after they both accepted the connection. Thus in the
"accept port connection" method, the ports are not connected yet: this
is not where the component can create a notification iterator because
the connection object does not exist.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 4 Apr 2017 22:04:44 +0000 (18:04 -0400)]
Rename text.text sink CC to text.pretty
The `text` plugin is expected to contain more than the `text` sink: it
could eventually read and write many plain text formats.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 4 Apr 2017 18:54:09 +0000 (14:54 -0400)]
Rename lib/component/ -> lib/graph/ to match include/babeltrace/graph/
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 4 Apr 2017 18:49:10 +0000 (14:49 -0400)]
Add `-internal` suffix to all internal header files
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 4 Apr 2017 18:11:14 +0000 (14:11 -0400)]
Add bt_version_get_*() functions to dynamically get the lib's version
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Fri, 24 Mar 2017 01:54:02 +0000 (21:54 -0400)]
.gitignore: ignore gcov files
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Fri, 24 Mar 2017 01:39:22 +0000 (21:39 -0400)]
ctf plugin: add CTF metadata decoder API
The new plugins/ctf/common/metadata/decoder.h header exposes the CTF
metadata decoder API. This is a common API used by both the ctf.fs and
ctf.lttng-live component classes.
Once you create a CTF metadata decoder object with
ctf_metadata_decoder_create(), you can call
ctf_metadata_decoder_decode() as many times as needed to decode chunks
of metadata. Those chunks can be packetized or not, however the
resulting metadata text needs to be "complete", that is, zero or more
top-level TSDL blocks ("declarations"). If ctf_metadata_decoder_decode()
cannot decode because the metadata text is incomplete, the function
returns CTF_METADATA_DECODER_STATUS_INCOMPLETE. It is then the caller's
responsibility to keep the existing metadata and append more metadata
to it and then call ctf_metadata_decoder_decode() again with this,
until the function returns CTF_METADATA_DECODER_STATUS_OK or another
error.
At anytime you can get the CTF metadata decoder's associated CTF IR
trace object with ctf_metadata_decoder_get_trace(). The trace object is
initially empty: as you call ctf_metadata_decoder_decode(), the decoder
makes it grow by adding other CTF IR objects to it: stream classes,
event classes to new or existing stream classes, clock classes, etc.
The public ctf_metadata_decoder_is_packetized() and
ctf_metadata_decoder_packetized_file_stream_to_buf() functions exist
only for the `metadata-info` ctf.fs query for the moment.
Also in this patch:
* The identical btr/print.h and notif-iter/print.h is moved to
metadata/print.h.
* A fix is added to the AST-to-CTF IR visitor to pop the current
declaration scope at the end of visit_event_decl().
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 4 Apr 2017 12:53:32 +0000 (08:53 -0400)]
tests/lib/common.c: add missing includes
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 4 Apr 2017 00:23:17 +0000 (20:23 -0400)]
bt_notification_event_create(): validate and freeze event
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 4 Apr 2017 00:13:24 +0000 (20:13 -0400)]
Add inactivity notification
The new inactivity notification indicates that there's no activity to be
expected on the iterator pointing to it until a given time. You specify
the given time with one or more clock values which are associated to
clock classes. Those clock classes must be mapped to a priority in the
notification's clock class priority map.
This notification is similar to the event notification, except that it
does not contain any context or payload. Its purpose is to make the
graph more efficient with live sources which know that a given iterator
won't deliver any nofication which "occur" before a given time. For
example, a muxer can add this notification to its internal heap, just
like it adds event notifications. Most sinks should ignore this
notification.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 3 Apr 2017 23:41:35 +0000 (19:41 -0400)]
Add frozen property to notification objects
A frozen notification cannot be modified (except for its reference
count). Currently, no notification can be modified after its creation
anyway, but we're excepting some.
The notification is frozen by bt_notification_iterator_next() when the
component's "next" method is successful.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 3 Apr 2017 23:28:53 +0000 (19:28 -0400)]
ir: bt_ctf_event_set_clock_value(): validate clock value's class
On bt_ctf_event_set_clock_value(): validate that the clock class of a
clock value is part of the event's trace object.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 3 Apr 2017 22:32:01 +0000 (18:32 -0400)]
ir: make sure you can't add a SC to a trace with a native BO
When you create a trace object with bt_ctf_trace_create(), its native
byte order is set to BT_CTF_BYTE_ORDER_NATIVE, which essentially means
"unset". Before freezing the trace (which only happens in
bt_ctf_trace_add_stream_class()), make sure that the trace's native byte
order is a real byte order, not still BT_CTF_BYTE_ORDER_NATIVE (unset).
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 3 Apr 2017 22:05:19 +0000 (18:05 -0400)]
CTF writer: restore native byte order is the CPU's native byte order
To remain compatible with the first experiments of CTF writer, let's
restore this legacy behaviour in which a native byte order means the
native byte order of the CPU running the Babeltrace library.
This only applies to bt_ctf_writer_set_byte_order() when you pass
BT_CTF_BYTE_ORDER_NATIVE: bt_ctf_trace_set_native_byte_order() does
not accept BT_CTF_BYTE_ORDER_NATIVE. Thus, when you create a CTF writer
object with bt_ctf_writer_create(), it sets its trace's native byte
order to the CPU's native byte order.
perf is a CTF writer user known to not call
bt_ctf_writer_set_byte_order() manually: in this case the CTF IR trace
would be invalid because its native byte order would still be set to
BT_CTF_BYTE_ORDER_NATIVE.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 3 Apr 2017 22:01:06 +0000 (18:01 -0400)]
Rename bt_ctf_trace_set_byte_order() -> bt_ctf_trace_set_native_byte_order()
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 3 Apr 2017 21:52:57 +0000 (17:52 -0400)]
test_bt_ctf_field_type_validation: fix compiler warnings
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 3 Apr 2017 21:48:51 +0000 (17:48 -0400)]
Rename bt_ctf_type_id -> bt_ctf_field_type_id (and the enumerators)
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Mon, 3 Apr 2017 20:39:45 +0000 (16:39 -0400)]
fix Makefile for libbabeltrace-ctf
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Mon, 3 Apr 2017 20:32:28 +0000 (16:32 -0400)]
fix warnings
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Mon, 3 Apr 2017 20:30:38 +0000 (16:30 -0400)]
fix missing libbabeltrace-ctf for libctfcopytrace
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Fri, 31 Mar 2017 17:34:58 +0000 (13:34 -0400)]
fixes after rebase on eepp-jgalar/fixes-mar-7
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Mon, 27 Mar 2017 19:32:52 +0000 (15:32 -0400)]
Text: handle output file
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Mon, 27 Mar 2017 19:11:38 +0000 (15:11 -0400)]
text: escape control sequences characters
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Tue, 21 Mar 2017 17:41:28 +0000 (13:41 -0400)]
Support for --clock-offset and --clock-offset-ns
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Mon, 20 Mar 2017 20:13:44 +0000 (16:13 -0400)]
Text output identical with babeltrace 1
Various fixes to make sure the text output stays the same as babeltrace
1. Tested all -f and -n options combinations with no differences.
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Fri, 3 Mar 2017 19:16:54 +0000 (14:16 -0500)]
fix: missing equal sign when printing events without colors
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Tue, 31 Jan 2017 18:12:38 +0000 (13:12 -0500)]
debug-info filter plugin
This plugin can be inserted in the graph to add the debugging
informations to events that have the necessary context informations (see
the README for usage informations).
Compared to the previous implementation, this version does not only
output the debug informations to the text output, but it adds the
debug_info structure into the CTF events. That way, the plugins and
sinks after this one see the debug_info as part of the event contexts.
The default name of the structure added to the events is "debug_info",
but can be overridden. If this structure already exists in the event
context, it is not added again.
If a trace does not have the ip and vpid event contexts in its stream
class, the trace is copied without adding the "debug_info" structure.
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Thu, 2 Mar 2017 22:06:14 +0000 (17:06 -0500)]
Make bt_ctf_field_structure_set_field public
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Thu, 23 Mar 2017 15:25:00 +0000 (11:25 -0400)]
cleanup error paths in trimmer, writer and ctfcopytrace
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Wed, 22 Feb 2017 21:49:29 +0000 (16:49 -0500)]
trimmer: Update the bounds of the trimmed packets
Update the timestamp_begin field of the first packet of each stream and
the timestamp_end field of the last packet to reflect the fact that the
packet content got truncated by the user. This is important for the
packet intersection feature afterwards. This requires that we create new
packets and copy the events to assign them to the new packets.
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Mon, 27 Feb 2017 19:53:41 +0000 (14:53 -0500)]
Fix graph facilities handling in writer component class
Commit
43e5ad310e9ea54e86dd3444e23c2d3c69827bc9 missed a few details to
make it work properly.
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Wed, 15 Mar 2017 20:04:31 +0000 (16:04 -0400)]
fix trimmer compiled library name
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Wed, 15 Feb 2017 19:10:46 +0000 (14:10 -0500)]
writer: create event classes lazily
Instead of copying all the event classes when we copy the stream
classes, we now create them only when needed. That way, we can use this
plugin in live where new events can get created after the trace has
already been opened.
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Thu, 2 Mar 2017 22:05:39 +0000 (17:05 -0500)]
libcopytrace: export ctf_copy_event_header
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Tue, 14 Feb 2017 17:03:00 +0000 (12:03 -0500)]
Override clock fields in copied traces
Some tracers like LTTng use a compression scheme on the timestamp field
to avoid writing the full 64-bit timestamp at every event. When the
trace is complete, the reader has all the information to understand this
compression, but if a trace is filtered or truncated, there might be
some state information missing.
Since we don't know in advance if a compression scheme is used in a
trace, we now force the copied traces to have a full 64-bit timestamp.
The user of this library can decide whether or not to override the type
of the clock fields.
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Tue, 14 Feb 2017 17:00:28 +0000 (12:00 -0500)]
Create a library to copy a CTF trace
Move all the code from the writer plugin to a standalone plugin library
so it can be used by other plugins.
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Tue, 14 Feb 2017 17:31:28 +0000 (12:31 -0500)]
Allow to set the size of an integer type
Add bt_ctf_field_type_integer_set_size to the API.
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Fri, 20 Jan 2017 21:11:01 +0000 (16:11 -0500)]
Fix writer: leak of the event classes
We have to release the writer_event_class once it is added to the
writer_stream_class. This also highlighted a problem with the ownership
of the stream, stream_class and writer objects which is now fixed.
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Fri, 20 Jan 2017 21:08:58 +0000 (16:08 -0500)]
Fix writer: missing put ref to values and types
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Wed, 18 Jan 2017 18:35:44 +0000 (13:35 -0500)]
Fix writer: leak of the header fields
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 3 Apr 2017 18:10:34 +0000 (14:10 -0400)]
Rename converter/ -> cli/ (it's more than a converter now)
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Fri, 31 Mar 2017 05:12:08 +0000 (01:12 -0400)]
Event notification: pass CC priority map on creation
An event notification must have an associated clock class priority map
to indicate the ranks of its event's clock values.
As of this patch, a ctf.fs source component always set the priority of
all the parsed clock classes to 0.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Sat, 1 Apr 2017 01:29:42 +0000 (21:29 -0400)]
Remove Babeltrace 1 files and reorganize the tree
This is one of the patches that you won't easily forget.
This patch removes the remaining legacy files, moving them if we still
need them, and reorganizes the tree as such:
* formats/ is removed
* formats/ctf/ir/ is moved to lib/ctf-ir/
* formats/ctf/writer/ is moved to lib/ctf-writer/
* types/ is removed
Because some of the CTF IR and CTF writer objects are so coupled, both
components are in libbabeltrace now. The build system creates a symbolic
link from libbabeltrace-ctf (where CTF writer used to reside) to
libbabeltrace, so that `-lbabeltrace-ctf` still works for the current
users of CTF writer.
converter/babeltrace-log.c still exists, but it's not build as of this
patch because it uses the legacy API. We need to change this to use CTF
writer and add it to the Makefile again.
Some debug info files are gone because they also use the legacy API.
They are updated anyway as part of the upcoming debug info component
class.
The Python bindings are not covered by this patch: a subsequent patch
should fix them at once.
Some tests which used the legacy API are removed.
The legacy include files are removed, except for
include/babeltrace/ctf/event.h which could be included by CTF writer
users. The file simply includes all the CTF writer header files now.
The functions to serialize integer and floating point number fields
are moved to lib/ctf-writer/serialize.c where a light
`struct bt_ctf_stream_pos` exists along with a few helper functions
for this renamed legacy object. The serialization functions use BT 2
objects now so that the dependency on the legacy API can be dropped.
The serialization functions accept a native byte order parameter now.
When a field type has a "native" byte order, the real (passed) native
byte order must be used. This ensures that:
* CTF IR objects do not need to propagate the trace's native byte order
to all the contained field types.
* Two references to the same field type which are part of two different
trace objects can have a native byte order without causing byte order
overwriting bugs.
The CTF IR code is simplified with this change. Also the
bt_ctf_trace_set_byte_order() function refuses the
BT_CTF_BYTE_ORDER_NATIVE byte order.
I also added internal inline functions to quickly access the parent
of some CTF IR object without getting a new reference:
* bt_ctf_event_borrow_event_class()
* bt_ctf_event_class_borrow_stream_class()
* bt_ctf_stream_class_borrow_trace()
Since the CTF parser test in formats/ctf/metadata/ was a legacy tool,
it's removed in this patch. It's not used anymore by test_ctf_writer
(only the converter runs to validate the generated trace).
Leaks are fixed in test_ctf_ir_ref and test_trace_listener.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Fri, 31 Mar 2017 05:10:31 +0000 (01:10 -0400)]
ctf.fs: bt_ctf_notif_iter_create(): assert() that all medops exist
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Fri, 31 Mar 2017 03:16:18 +0000 (23:16 -0400)]
trace.h: update API doc
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Fri, 31 Mar 2017 02:42:42 +0000 (22:42 -0400)]
tests: add clock class priority map tests
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Fri, 31 Mar 2017 02:28:59 +0000 (22:28 -0400)]
Add clock class priority map object
This new object is a simple map of clock classes to their priorities
against the other clock classes of the same map. See the header
file's documentation for more information (clock-class-priority-map.h).
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 29 Mar 2017 21:44:06 +0000 (17:44 -0400)]
ctf.fs: split streams, one per port
The ports are named `traceN-stream-STREAM`, where `N` is the index of
the trace (starts at 0) and `STREAM` is the base name of the stream
file.
The heap which used to be in this component class is expected to be
moved to the utils.muxer filter component class.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 29 Mar 2017 20:16:13 +0000 (16:16 -0400)]
Add user data for private port
A private port belongs to a private component, so it's okay to set
custom user data within a port. The user must make sure to release the
private user data whatever happens. The easiest solution is to make
a port's private data owned by the component's private data.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 28 Mar 2017 16:01:49 +0000 (12:01 -0400)]
Add graph topology tests
The new tests verify that the component methods and graph listeners are
called by the graph framework in reaction to specific events with the
expected parameters and in the expected order.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 29 Mar 2017 15:55:11 +0000 (11:55 -0400)]
Call a single "ports connected/disconnected" graph listener instead of two
It is reasonable to believe that a user implementing a
"ports connected" or "ports disconnected" graph listener wants both
the upstream and downstream ports, instead of getting called two times
with one and the other.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 29 Mar 2017 06:27:53 +0000 (02:27 -0400)]
Fix: call acting component's "port disconnected" method too
When a port is disconnected, call both upstream and downstream
components. It's okay to get notified as a component even if you
caused this notification.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 29 Mar 2017 02:31:45 +0000 (22:31 -0400)]
bt_graph_connect() -> bt_graph_connect_ports()
This is more explicit.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 29 Mar 2017 02:04:59 +0000 (22:04 -0400)]
Rename <babeltrace/component/...> -> <babeltrace/graph/...>
Also put all the graph-related header files directly in this directory,
not in subdirectories.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
This page took 0.043243 seconds and 4 git commands to generate.