Jérémie Galarneau [Sat, 27 May 2017 19:00:39 +0000 (15:00 -0400)]
Fix: NULL dereference in logging on btr allocation failure
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Sat, 27 May 2017 18:59:30 +0000 (14:59 -0400)]
Fix: NULL dereference in logging on notit allocation failure
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Sat, 27 May 2017 18:54:16 +0000 (14:54 -0400)]
Fix: dereference of NULL mdec when opening packetized metadata file
ctf_metadata_decoder_packetized_file_stream_to_buf() uses
ctf_metadata_decoder_packetized_file_stream_to_buf_with_mdec() with
a NULL mdec. This results in a NULL dereference whenever the mdec
error sream is accessed.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Sat, 27 May 2017 18:48:20 +0000 (14:48 -0400)]
Fix: potential NULL dereference of ctf_fs_file path
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Sat, 27 May 2017 18:44:06 +0000 (14:44 -0400)]
Fix: ds_file_munmap must check ds_file for NULL
ds_file_munmap may be called with a NULL file in
ctf_fs_ds_file_create()'s error path.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Sat, 27 May 2017 18:37:18 +0000 (14:37 -0400)]
Fix: unchecked bt_ctf_event_set_clock_value return value
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Sat, 27 May 2017 18:35:58 +0000 (14:35 -0400)]
Clean-up: unused next_return assignation in muxer test
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Sat, 27 May 2017 18:31:40 +0000 (14:31 -0400)]
Fix: uninitialized ret value used in set_debug_info_field
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Sat, 27 May 2017 18:26:06 +0000 (14:26 -0400)]
Fix: possible NULL dereference of uuid in test
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Fri, 26 May 2017 06:33:23 +0000 (02:33 -0400)]
lib/plugin/plugin.c: add logging
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Fri, 26 May 2017 05:02:18 +0000 (01:02 -0400)]
Replace all assert(false) and assert(0) with abort()
Because assert() statements are not executed with a release/production
build, assert(false) and assert(0) statements are ignored and the
program's execution continues in an unexpected state. This could lead to
very weird and hard-to-debug situations, and potentially to corrupted
output traces.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Fri, 26 May 2017 00:56:40 +0000 (20:56 -0400)]
lib/graph/iterator.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, 25 May 2017 23:12:13 +0000 (19:12 -0400)]
lib/graph/clock-class-priority-map.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, 25 May 2017 22:55:41 +0000 (18:55 -0400)]
lib/graph/component-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, 25 May 2017 22:25:36 +0000 (18:25 -0400)]
lib/graph/sink.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, 25 May 2017 22:25:25 +0000 (18:25 -0400)]
lib/graph/filter.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, 25 May 2017 22:25:15 +0000 (18:25 -0400)]
lib/graph/source.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, 25 May 2017 22:01:09 +0000 (18:01 -0400)]
Remove useless component/iterator validation functions
They only "validate" what we can assert anyway.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 25 May 2017 21:57:09 +0000 (17:57 -0400)]
bt_notification_iterator_create(): assert the type of comp. class
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 25 May 2017 21:56:21 +0000 (17:56 -0400)]
lib/graph/connection.c: add logging
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Thu, 25 May 2017 20:47:10 +0000 (16:47 -0400)]
fix: bt_put on potentially unintialized variable
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Thu, 25 May 2017 20:32:53 +0000 (16:32 -0400)]
fs-sink: only subscribe to relevant notifications
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Thu, 25 May 2017 19:55:37 +0000 (15:55 -0400)]
fix: useless warning
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Thu, 25 May 2017 18:51:03 +0000 (14:51 -0400)]
Fix debug-info leak: unbalanced get/put
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Thu, 25 May 2017 16:09:44 +0000 (12:09 -0400)]
trimmer: cleanup the packet_map if iterator destroyed early
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Thu, 25 May 2017 16:05:37 +0000 (12:05 -0400)]
debug_info fix: useless reference
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Tue, 23 May 2017 19:04:27 +0000 (15:04 -0400)]
debug-info fix: remove useless get function
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Tue, 23 May 2017 18:04:02 +0000 (14:04 -0400)]
trimmer: close when end is reached
When an event has a timestamp past the specified end timestamp, the
iterator now returns it is end which closes the graph. We also check if
the timestamp begin of a packet is after the end timestamp.
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Tue, 23 May 2017 16:26:47 +0000 (12:26 -0400)]
trimmer fix: notification handling
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Wed, 17 May 2017 21:00:41 +0000 (17:00 -0400)]
debug_info: fix graph connection
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Wed, 17 May 2017 21:00:04 +0000 (17:00 -0400)]
fix copytrace: set the byte order
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Wed, 17 May 2017 20:58:55 +0000 (16:58 -0400)]
copytrace: option to skip the copy of packet/content size
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Julien Desfossez [Wed, 17 May 2017 20:54:00 +0000 (16:54 -0400)]
fix: optional fields
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 25 May 2017 17:45:54 +0000 (13:45 -0400)]
lib/graph/notification/event.c: fix clock class leak
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 25 May 2017 17:27:01 +0000 (13:27 -0400)]
lib/graph/port.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, 25 May 2017 07:12:30 +0000 (03:12 -0400)]
Remove component's initialization state flag
This "initializing" flag is now useless. It was used to make sure that
only the implementation side of a component could set the component's
private user data. This is now enforced by typing (component vs. private
component), and it is always okay to set a private component's user
data.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 25 May 2017 07:06:13 +0000 (03:06 -0400)]
lib/graph/component.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, 25 May 2017 07:05:33 +0000 (03:05 -0400)]
bt_ctf_stream_map_component_to_port(): log before and after
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 25 May 2017 06:36:25 +0000 (02:36 -0400)]
Remove bt_component_set_name()
This is not used anywhere, and there's not even a public declaration for
it. Plus a component object has no frozen property, and for obvious
reasons we can't change the name of a component once it's part of a
graph. All the properties of a component must be set at creation time.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 25 May 2017 00:28:17 +0000 (20:28 -0400)]
lib/graph/graph.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, 25 May 2017 00:12:56 +0000 (20:12 -0400)]
Remove bt_graph_add_component_as_sibling()
This is not used anywhere, and it's one more thing to test. It remains
in the archives in case we need it in the future. This was created in
the days when it was expected that components would duplicate themselves
to share resources instead of dynamically adding ports like today.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 24 May 2017 23:09:58 +0000 (19:09 -0400)]
bt_ctf_trace_destroy(): logging: difference between destroying and putting
In some cases we know for sure that we're destroying the objects, not
just putting them.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 24 May 2017 23:09:23 +0000 (19:09 -0400)]
bt_ctf_stream_class_destroy(): log what is being destroyed/put
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 24 May 2017 23:08:40 +0000 (19:08 -0400)]
lib/ctf-ir/event-class.c: minor logging message edit
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 24 May 2017 22:37:15 +0000 (18:37 -0400)]
lib/ctf-ir/validation.c: add logging
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 24 May 2017 22:21:48 +0000 (18:21 -0400)]
ref.c: warn when the ref count goes from 0 to
18446744073709551615
This unlikely conditin indicates a double bt_put(), or something that
went really wrong, and should be reported to the user as a warning.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 24 May 2017 22:17:25 +0000 (18:17 -0400)]
ref.c: do not change ref count when release function is not set
This is the case of the null value singleton, bt_value_null, on which
you can call bt_get() and bt_put() and they should have no effect.
Before this patch, we can see log messages of the ref count going from 0
to
18446744073709551615 and other weird, huge values.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 24 May 2017 21:59:40 +0000 (17:59 -0400)]
lib/ctf-ir/resolve.c: add logging
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 24 May 2017 21:59:03 +0000 (17:59 -0400)]
field-path.c: add internal function to stringify a field path
This is to be used by logging statements.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 24 May 2017 19:03:15 +0000 (15:03 -0400)]
lib/ctf-ir/trace.c: add logging
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 24 May 2017 07:23:26 +0000 (03:23 -0400)]
ctf.fs source: make traces static when all streams are created
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 24 May 2017 07:05:55 +0000 (03:05 -0400)]
plugin-so.c: use BABELTRACE_NO_DLCLOSE env. var. to avoid dlclose()
See new comment in plugin-so.c.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 24 May 2017 00:47:58 +0000 (20:47 -0400)]
ctf.fs source: add trace file rotation (stream instance ID) support
ctf.fs source is changed as such:
* A CTF FS trace owns zero or more stream file groups.
* A stream file group owns a unique CTF IR stream object and one or more
stream file infos.
* A stream file info contains a path and a beginning timestamp (the
beginning timestamp of the stream file's first packet).
* Stream file infos are ordered by time in a stream file group.
* One output port is created for each stream file group. It is also
associated to this stream file group through private port's user data.
The name of the port is always the stream file group's first stream
file info's path, which is always the path of stream file containing
the oldest packet. This can be useful to isolate a group of stream
files by name and possibly CPU ID, e.g. (CPU 1 of LTTng channel
`my-channel`):
--connect='ctf.*my-channel_1_*:mux'
or all CPUs of LTTng channel `hello-chan`:
--connect='ctf.*hello-chan_*:mux'
* The user data of a notification iterator contains its upstream port's
stream file group and a stream file info index.
* For a given notification iterator, one data stream file object (owner
of a binary notification iterator and the one which does the stream
file memory mapping) is always active. When it returns a
BT_NOTIFICATION_ITERATOR_STATUS_END status, the data stream file is
destroyed and the next stream file info is used to create a new data
stream file, from which the real next notification is obtained. If
there's no more stream file info in the stream file group, then
BT_NOTIFICATION_ITERATOR_STATUS_END is returned.
This patch effectively makes a ctf.fs source component create one unique
stream, and thus one port, for each stream instance of each trace,
therefore supporting trace file rotation. Only one stream file is
opened and memory mapped at any time for a given stream instance.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 24 May 2017 00:45:08 +0000 (20:45 -0400)]
ctf plugin: add bt_ctf_notif_iter_get_packet_header_context_fields()
The new bt_ctf_notif_iter_get_packet_header_context_fields() function
returns the packet header and context fields using the usual medium
operation mechanism without ever creating packet of event objects,
therefore not requiring a stream object to exist.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 24 May 2017 00:43:00 +0000 (20:43 -0400)]
ir: add stream ID API
The new bt_ctf_stream_create_with_id() function creates a stream object,
just like bt_ctf_stream_create(), but with a numeric ID. You cannot
call this function to create a CTF writer stream because CTF writer
streams initialize their own unique ID.
Use bt_ctf_stream_get_id() to get a stream's ID.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 23 May 2017 15:25:26 +0000 (11:25 -0400)]
cli: --force-correlate -> utils.muxer's `ignore-absolute` parameter
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 23 May 2017 15:25:05 +0000 (11:25 -0400)]
Fix: do not require lttng-utils.debug-info with --disable-debug-info
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 23 May 2017 02:07:15 +0000 (22:07 -0400)]
Fix: ctf.fs source: append all ctf_fs_trace objects to component's list
This avoids obvious potential leaks.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 22 May 2017 19:33:03 +0000 (15:33 -0400)]
ctf.fs source: recurse to find multiples CTF traces
One port per CTF data stream amongst all the traces that are found
from the user's starting path is created.
The traces are named so as to be able to replicate the original tree
by stripping their common prefix within slash boundaries.
For example: user passes `hello` as the starting path, the component
finds the following traces:
hello/world/kilo
hello/yes
hello/ispep/zero/mini
These traces would be named:
world/kilo
yes
ispep/zero/mini
Another example: user passes `hello` as the starting path, the
component finds the following trace:
hello/world/kilo
In this case, the trace is named `kilo`.
I used realpath() to normalize the paths and make sure that there aren't
`.` or `..` in the trace's name. Opening a trace located directly in `/`
is not supported.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Sat, 20 May 2017 01:46:25 +0000 (21:46 -0400)]
Fix warnings emitted by `gcc -Wall`
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Sat, 20 May 2017 00:49:41 +0000 (20:49 -0400)]
Library: log version (INFO) on construction
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Sat, 20 May 2017 00:37:30 +0000 (20:37 -0400)]
babeltrace(1): reset console after graph stops running
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Sat, 20 May 2017 00:32:45 +0000 (20:32 -0400)]
logging-internal.h: use __attribute__((format)) to check parameters
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Sat, 20 May 2017 00:32:16 +0000 (20:32 -0400)]
Logging: fix wrong parameters, superfluous commas, etc.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Sat, 20 May 2017 00:21:33 +0000 (20:21 -0400)]
lib/ctf-ir/event.c: replace some BT_LOGE() with BT_LOGW()
Field serialization can fail because of a user error, for example trying
to serialize a field which is not set.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Fri, 19 May 2017 23:56:09 +0000 (19:56 -0400)]
CTF writer: stream: handle automatic fields more securely
The stream.c code for automatically writing the values of selected
fields in the packet context, packet header, and event header fields is
not super secure, in that the user could make the stream object write an
invalid CTF data stream file.
The code is updated to follow those rules:
* Packet header field:
* `magic` field: always force to 0xc1fc1fc1. Override any current
value.
* `uuid` field: always force to trace's UUID. Override any current
value.
* `stream_id`: always force to stream's class's ID. Override any
current value.
* Packet context field:
* `packet_size`: always force to the size of the packet being flushed.
Override any current value.
* `packet_size`: always force to the current packet's offset. Override
any current value.
* `timestamp_begin`: if the field's type is mapped to the stream's
class's clock class, force to the timestamp of the stream's first
recorded event (if any, and if this timestamp is itself mapped to
the same clock class), overriding the user's value.
* `timestamp_end`: if the field's type is mapped to the stream's
class's clock class, force to the timestamp of the stream's last
recorded event (if any, and if this timestamp is itself mapped to
the same clock class), overriding the user's value.
* `events_discarded`: always force to the stream's current discarded
events count (now a dedicated member of the stream object to keep
this value safe). Override any current value.
* Event header field:
* `timestamp`: if the field's type is an integer field type which is
mapped to the stream's class's clock class, force to the current
value of the stream's class's clock, overriding the user's value.
* `id`: if the field's type is an integer field type, force to the
event's class's ID, overriding the user's value.
* If the stream's packet context does not exist or does not contain
a `packet_size` field, the user can only flush the stream one time.
* If the stream's packet context does not exist or does not contain a
`content_size` field, the content size (current offset) of the packet
to flush must be equal to its packet size.
Those rules are more strict than before, but they ensure that the
written stream is valid. Writing an invalid CTF stream, or CTF trace at
all, is not a CTF writer use case. This is in line with the project's
first precept: don't trust the user.
I added assertions which check that the packet size is always a multiple
of 8: this is suggested by CTF 1, and required by (eventual) CTF 2. This
is always the case here because the packet's initial size is 8 pages and
then it's incremented by this value each time. If it is a requirement
that the user should be able to control the packet size, then we should
add a function to set the expected packet size before flushing the
stream, not rely on the `packet_size` field's value.
There are still a few cases which remain to be checked. For example, if
the stream class's event header field type's `id` field does not exist,
and there's more than one event class in the stream's class, we write
the event anyway without any warning: this is because LTTng is known to
have a complex system of `id` and `timestamp` fields with extended
structures depending on the ID value, and the ctf.fs sink component
class uses CTF writer as is. That said, in the most common scenarios,
`id` is an integer field type.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 18 May 2017 23:52:41 +0000 (19:52 -0400)]
Validate CTF semantics in selected CTF IR functions
Before this patch, the semantics suggested by the CTF specification are
not validated in CTF IR itself. For example, the library does not
enforce that, if there's more than one stream class contained in a given
trace, its packet header field type's `stream_id` field must exist
(which also means that the packet header field type must be set).
When you add a stream class to a trace created by a CTF writer object
(implicit when you call bt_ctf_writer_create_stream(), for example), we
proceed to automatically map selected field types to the stream class's
clock if it's set. Those fields are:
* Packet context field type: `timestamp_begin`
* Packet context field type: `timestamp_end`
* Event header field type: `timestamp`
If those fields are not mapped to a clock class, and if there's no
current stream class's clock, then the whole
bt_ctf_trace_add_stream_class() function fails.
Those mappings are needed to make a valid CTF trace. The field types
cannot be mapped at stream class creation time because the user can
override the packet context and event header field types and still have
those fields without a mapping. To make this use case more easy in CTF
writer context, the mapping is always done automatically in
bt_ctf_trace_add_stream_class().
This has the side effect that this sequence of operations is not valid
anymore:
1. Create a trace.
2. Create a default stream class with bt_ctf_trace_add_stream_class().
3. Add the default stream class (2) to the created trace (1).
Because bt_ctf_trace_add_stream_class() creates an initial packet
context field type which contains the `timestamp_begin` and
`timestamp_end` fields, and because those fields are only valid at
bt_ctf_trace_add_stream_class() call time when they are mapped to a
clock class, and because we're not in CTF writer context, then they are
not automatically mapped. This is why, in non CTF writer mode (graph
mode), the user should prefer bt_ctf_stream_class_create_empty(), or
manually get the `timestamp_begin` and `timestamp_end` field types and
map them to a clock class which is also part of the trace in which to
add the stream class.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 18 May 2017 23:49:53 +0000 (19:49 -0400)]
Event notification: make sure contained event has a trace
Because we need to keep support for legacy CTF writer behaviours, we can
still create a "floating" event without its stream class attached to a
trace. Disallow the creation of an event notification with such an event
to provide the guarantee to filter and sink components that you can
always find the trace of an event notification's event.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 18 May 2017 18:52:24 +0000 (14:52 -0400)]
lib/ctf-ir/stream.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, 18 May 2017 18:51:12 +0000 (14:51 -0400)]
fields.c: get non-existing field: log level WARN -> VERBOSE
It is possible that a user needs to check if a structure field's field,
for example, is set (exists). If it does not, the given function returns
NULL, but this is not an error: the function is used to check here, not
to create the field.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Thu, 18 May 2017 18:50:11 +0000 (14:50 -0400)]
bt_ctf_event_serialize(): do not log whole function (done in stream.c)
We already log the current event being serialized in
bt_ctf_stream_flush(): do not log twice.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Wed, 17 May 2017 20:53:31 +0000 (16:53 -0400)]
Fix: lttng-live enum mismatch
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 17 May 2017 20:31:27 +0000 (16:31 -0400)]
lib/ctf-ir/field-types.c: use `int`, not `int64_t` for return value
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Wed, 17 May 2017 18:55:35 +0000 (14:55 -0400)]
Fix: lib/ctf-ir/event-class.c: fix warnings on `ret` condition
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 16 May 2017 21:35:42 +0000 (17:35 -0400)]
Fix: g_quark_try_string() is usually not a WARN trigger
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 16 May 2017 21:18:55 +0000 (17:18 -0400)]
Fix: set no field in event/packet without warnings or failing
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Tue, 16 May 2017 18:42:18 +0000 (14:42 -0400)]
lttng-live: handle EINTR and graph cancelation
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Tue, 16 May 2017 15:53:22 +0000 (11:53 -0400)]
Fix: invoke bt_ctf_trace_set_is_static only when trace is destroyed
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 16 May 2017 04:09:06 +0000 (00:09 -0400)]
lib/ctf-ir/utils.c: add logging
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 16 May 2017 04:06:04 +0000 (00:06 -0400)]
lib/ctf-ir/fields.c: add logging
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 16 May 2017 02:37:00 +0000 (22:37 -0400)]
lib/values.c: add more verbose/debug logging
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 16 May 2017 02:36:47 +0000 (22:36 -0400)]
lib/ctf-ir/packet.c: add more debug logging
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 16 May 2017 02:35:32 +0000 (22:35 -0400)]
lib/ctf-ir/event-class.c: add more verbose/debug logging
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 16 May 2017 02:34:27 +0000 (22:34 -0400)]
lib/ctf-ir/attributes.c: add assert()
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 16 May 2017 02:13:25 +0000 (22:13 -0400)]
Update logging guide: more about the WARN level
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 16 May 2017 02:03:53 +0000 (22:03 -0400)]
lib/ctf-ir/field-types.c: logging: log more details
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 16 May 2017 01:08:06 +0000 (21:08 -0400)]
lib/ctf-ir/event.c: logging: fix log levels and more verbose/debug logging
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 16 May 2017 01:01:02 +0000 (21:01 -0400)]
lib/ctf-ir/field-types.c: logging: log struct/var FT field destruction
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 16 May 2017 00:57:45 +0000 (20:57 -0400)]
lib/ctf-ir/field-types.c: logging: log only specific functions
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Tue, 16 May 2017 00:42:24 +0000 (20:42 -0400)]
lib/ctf-ir/field-types.c: logging: log more details when freezing
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Mon, 15 May 2017 21:37:30 +0000 (17:37 -0400)]
lttng-live: change loglevel env var to BABELTRACE_PLUGIN_CTF_LTTNG_LIVE_LOG_LEVEL
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Mon, 15 May 2017 21:33:38 +0000 (17:33 -0400)]
lttng-live: ensure that port connections go to the same component
Also has tiny cleanups.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Mon, 15 May 2017 20:44:09 +0000 (16:44 -0400)]
Fix: don't call iterator finalize more than once
A finalize may have side-effects that trigger port removal, thus calling
finalize again. Ensure it is not called more than once.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Mon, 15 May 2017 15:48:32 +0000 (11:48 -0400)]
Fix: muxer: handle CANCELED status
Since commit
bbd6694a2 "Collect useless graph's connections", the
lttng-live component may return a CANCELED state to the muxer. The muxer
should deal with this state as an "END" state.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 15 May 2017 19:51:32 +0000 (15:51 -0400)]
Update logging guide
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Mon, 15 May 2017 19:50:28 +0000 (15:50 -0400)]
lib/ctf-ir/field-types.c: add verbose logging (modifying functions)
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Mon, 15 May 2017 14:48:10 +0000 (10:48 -0400)]
LTTng live: use common url parser
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Fri, 12 May 2017 21:10:27 +0000 (17:10 -0400)]
Implement cmd_print_lttng_live_sessions
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Sun, 14 May 2017 21:34:18 +0000 (17:34 -0400)]
lib/values.c: use assert() instead of checking error
In this case we know that it should not fail.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Philippe Proulx [Sun, 14 May 2017 21:33:59 +0000 (17:33 -0400)]
lib/ctf-ir/stream-class.c: logging: fix typo
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
This page took 0.043039 seconds and 4 git commands to generate.